Reputation: 31
I get this error when I run npm start
.
npm ERR! Missing script: "start" npm ERR! Did you mean one of these? npm ERR! npm star # Mark your favorite packages npm ERR! npm stars # View packages marked as favorites npm ERR! To see a list of scripts, run: npm ERR! npm run npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\USER\AppData\Local\npm-cache\_logs\2022-04-28T13_04_19_260Z-debug.log
Upvotes: 0
Views: 22815
Reputation: 1
there will be an option to debug in the code above the scripts . just click on the debug option and click on start or build or whatever fuctionality you want to do.....
Upvotes: 0
Reputation: 1
if you are facing this issue for the react after creating the react app then always check for the folder are you in is correct or not .....? run cd "project name"
and try npm start
command again
Upvotes: 0
Reputation: 1
Do you have put node on Firewall settings public an private network
Upvotes: 0
Reputation: 1
Just happened to me and my package.json was correct. My fix was that I had something running on port 3000 & didn't realize it.
Upvotes: 0
Reputation: 1
I had the same error and I had the "start" script and everything should have worked, but it didn't. What actually helped me eventually was just saving the changes, ctrl+s. That's it, I just had to save changes and then it worked.
Upvotes: 0
Reputation: 27
"scripts": {
"start": "what command is here?",
},
Upvotes: 1
Reputation: 1143
package.json
has various sections, scripts
is one of them, which allows you to write npm scripts which we can run using npm run <script-name>
. The error you're getting is because your start
script is missing in that section.
For a node app, your package.json
file should look similar to this.
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.20.0",
"cors": "^2.8.5",
"express": "^4.17.3"
}
}
In the above code, focus on the scripts
section. The following line is missing in your package.json
file.
"scripts": {
"start": "node app.js",
},
Add this line and you're good to go.
Upvotes: 1
Reputation: 180
You have to put what command you need npm to run when you give npm start.
You have to write node index.js in scripts.start in your package.json file
Upvotes: -1