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"
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"
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 are using Node.js 22 or higher, you don't need to use npm run
. Node.js provides a faster and native alternative.
The node --run
command will execute the scripts in package.json
:
node --run start
Or like this:
node --run start:dev
© 2022 - 2024 — McMap. All rights reserved.
start:dev
– Tortricid