问题
I'm trying to run this example. I have these errors when I start running it:
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR!/home/username/.npm/_logs/2018-04-15T09_19_49_453Z-debug.log
any help?
回答1:
your scripts of package.json should be:
"scripts": {
"start": "node ./examples/app.js",
"test": "echo \"Error: no test specified\" && exit 1"
}
回答2:
It looks like there is no start command in scripts i.e in your package.json file. Below is the start command you need to add to your scripts in package.json file, if it is not available.
"scripts": {
"start": "node your-script.js"
}
Or you could directly run the following command
node your-script.js
This error can also occur if there is a second entry of script key in your package.json file, try removing the second entry and run it works.
回答3:
As above, make sure that you have your start scripts.
"scripts": {
"start": "node ./examples/app.js",
"test": "echo \"Error: no test specified\" && exit 1"
}
Also, make sure that you are in the correct client side of the application when running npm start.
来源:https://stackoverflow.com/questions/49840457/missing-script-start