I've two scripts in package.json
"start:dev": "nodemon ./src/index.js",
"start": "npm run build && node ./build/index.js",
npm start
works well.
I need to run "start:dev": "nodemon ./src/index.js"
json file: To execute your Script, use the 'npm run <NAME-OF-YOUR-SCRIPT>' command. Some predefined aliases convert to npm run, like npm test or npm start, you can use them interchangeably.
You can use npm hook scripts to do something after package is installed. Create node_modules/. hooks/postinstall executable and it will be run also after npm install <package> .
You can easily run scripts using npm by adding them to the "scripts" field in package. json and run them with npm run <script-name> . Run npm run to see available scripts. Binaries of locally install packages are made available in the PATH , so you can run them by name instead of pointing to node_modules/.
For most custom npm scripts you need to add run
before script name
npm run start:dev
npm - The main scripts such as start, stop, restart, install, version or test do not require run command. These scripts and some other are described in npm documentation.
npm start
The others need run command before the script name as was pointed by David.
npm run start:dev
Yarn - You can also use yarn and in that case you do not have to specify run.
yarn start
yarn start:dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With