What's the difference between npm run dev and npm start?

this is the official Webpack template of vue scaffolding. What is the meaning of "start": "npm run dev" in it

what is the difference between npm run dev and npm start?

Why can"t you execute the dev command under scripts configuration by typing npm dev directly, but npm start can?

  "scripts": {
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "start": "npm run dev",
    "lint": "eslint --ext .js,.vue src",
    "build": "node build/build.js"
  },

to execute the command in scripts , you need npm run command name .
npm start can be run for developers' convenience, npm-start .

This runs an arbitrary command specified in the package's "start" property of its "scripts" object. If no "start" property is specified on the "scripts" object, it will run node server.js.

npm start executes the start field in scripts . If there is no start field, execute node server.js .


npm start and npm run start are equivalent. In a npm management project, the definition of start is generally defined by default and will be used frequently, so the abbreviation of npm run start is simplified in the implementation of npm, such as npm stop, npm test, and so on. Other less common command items can only be executed in the form of npm run < command item >

.
Menu