简体   繁体   中英

While i am trying to open my react app the CMD showing an npm err! Saying 'npm err! missing script:start' can anyone help me?

enter image description here

I've searched in previous answers and tried to solve this for many hours but with no success. I've typed in the terminal npm create-react-app, moved to the correct cd, and it gives me this error:

'npm ERR: missing script: start'

Start by validating that the 'start' script exists inside the package.json. That's where the script gets invoked. It should be under the key "scripts". If it's not there then that's the problem.

Should look something like this (if using react-scripts dependency):

"scripts": {
    "start": "react-scripts start",
    ....
}

And if you're missing dependencies then run the following command inside the project directory to install them:

npm install

You should ensure that you have package.json in your project and it has the command start registered in it, example

"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"

},

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