What is the difference between npm start and npm run

npm startand npm runare both npm commands, the differences between them are as follows:

  • npm startis one of npm's built-in commands for starting projects. It looks for a file in the root of the project package.json, and in that file it looks for the commands scriptsin the fields start. If the command is found, it will be executed to start the project, otherwise an error will be reported.
  • npm runAlso a command for npm to run package.jsoncustom scripts in files. Its syntax is npm run script_namewhere script_nameis package.jsonthe name of the script defined in the file. Unlike npm start, other custom scripts npm runcan be run except start, and the script name must be specified explicitly. In short, npm startit is a special, built-in command used to start the project; and npm runit is a general command used to run custom scripts.

Guess you like

Origin blog.csdn.net/ihateright/article/details/131185762