简体   繁体   中英

How to run start scripts from package.json?

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"

对于大多数自定义 npm 脚本,您需要在脚本名称之前添加run 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM