[Solved] Start script missing error when running npm start
Problem:
I am a python developer. For my work purpose, I am doing a node js project. Whenever I try to run the application using npm start I get this error:
Error: missing script: start
at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:142:19)
at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:58:5
at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:345:5
at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:309:45)
at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:343:3)
How can I solve this problem?
So in this article, we are going to solve the start script missing error when running npm start - this problem
Solution:
1. This error mainly happens because you did not give the run command from the root of the project. First of all check and make sure you are to cd into the folder before giving the run command.
2. If you are at the root of your project and it is still giving you the same error. Then check your package.json file and add this line to your package.json :
"scripts": {
"start": "node your-script-name.js"
}
Hopes this solves the problem you are having. If you have any more questions you can comment below.