When I am trying to run my code using npm start I am getting this error -
npm start -
npm ERR! Missing script: "start"
npm ERR!
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! 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\Local\npm-cache_logs\2023-01-20T08_18_49_238Z-debug-0.log
CodePudding user response:
Hi you need to define the start script in the package.json file. For example here in this node project package.json (remove the comment to use the json):
{
"name": "node-starter",
"version": "0.0.0",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js" // <-- start script here to start a node program
}
}
Full example https://stackblitz.com/edit/node-g7ntls?file=index.js,package.json
CodePudding user response:
You can use like node entry.js