How to determine whether or not to add run to the command defined in scripts of package.json when npm is called?

"scripts": {
    "dev": "node build/dev-server.js",
    "build": "node build/build.js"
},

as mentioned in the question, I always thought that the above commands were invoked in this way

npm run dev
npm run build

when learning the webpack-dev-server chapter of webpack, the official tutorial uses npm start, instead of npm run start,. When to add run, and when not to add run?


usually such as start command, test command can not add run , but dev these commands need to add run . You can edit package.json and try it yourself.


you can refer to the official documentation. Except for the commands in [this command list] , you need to add run in all cases.

reference address: How npm handles the" scripts "field


the easiest way is to add run,. Of course, npm start can be used as a special treatment

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e36aaf-443d8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e36aaf-443d8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?