简体   繁体   中英

Why is npm start error creating react app

I'm learning reactjs I started with installing nodejs and then ran these commands inside my project folder "React"

npx create-react-app hello-world
cd hello-world
npm start

but then instead of going to the browser i receive error:

npm ERR! missing script: start

npm ERR! A complete log of this run can be found in: npm ERR!
C:\\Users\\abc\\AppData\\Roaming\\npm-cache_logs\\2020-02-21T13_34_26_640Z-debug.log

PACKAGE.JSON CODE:

{
  "name": "hello-world",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-scripts": "3.4.0"
  }
}

Help me solve this error i dont want it to demotivate me from learning React

npm scripts are missing inside your package.json file

npm ERR! missing script: start

Edit your package.json as follows:

{
  "name": "hello-world",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build"
  },
  "dependencies": {
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-scripts": "3.4.0"
  }
}

I was also facing almost same type of problem. But then tried

yarn create react-app my-app

in power shell with admin privilege which seemed to do the trick.

Also you'll need to have Node >= 8.10, yarn >= 0.25+ on your machine as the official doc suggests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM