npm run dev 和 npm run serve

 

1, triggered by thinking ERR

Create a good project directly executed vue vue run dev error? Run vue run serve can be started as follows ...

npm run dev
npm ERR! missing script: dev

npm ERR! A complete log of this run can be found in:
npm ERR!     E:\nodejs\node_cache\_logs\2018-12-12T15_06_08_674Z-debug.log

2、dev build serve?

In fact npm run dev or npm run serve and other npm run xxx does not have to be so written.
npm run XXX configuration script is executed in package.json, such as:

"scripts": {
  "serve": "vue-cli-service serve",
  "build": "vue-cli-service build",
  "lint": "vue-cli-service lint"
},

NPM run xxx xxx can be understood as the key-value pairs of key, value is actually run scripts in package.json arranged inside;

For example, npm run serve actual running vue-cli-service serve;

The previously run on the 3.0 is the node build / dev-server.js file;

This time we will look at the problem is not on top of it suddenly, scripts and is not configured dev, so console called the [missing script: dev] error;

 

3, summary

npm run xxx, not what you want to run to run, and only in package.json  scripts  configured, you can run, so not all projects npm run dev / build.

To understand what these commands do, it is necessary to execute scripts seen what specific code.

It's like a shortcut to some commands, eliminating input every time a long command (for example, serve the line)

General project will have a build, dev, unit, etc., so named, at least on the basic can tell from the name is doing.

1, triggered by thinking ERR

Create a good project directly executed vue vue run dev error? Run vue run serve can be started as follows ...

npm run dev
npm ERR! missing script: dev

npm ERR! A complete log of this run can be found in:
npm ERR!     E:\nodejs\node_cache\_logs\2018-12-12T15_06_08_674Z-debug.log

2、dev build serve?

In fact npm run dev or npm run serve and other npm run xxx does not have to be so written.
npm run XXX configuration script is executed in package.json, such as:

"scripts": {
  "serve": "vue-cli-service serve",
  "build": "vue-cli-service build",
  "lint": "vue-cli-service lint"
},

NPM run xxx xxx can be understood as the key-value pairs of key, value is actually run scripts in package.json arranged inside;

For example, npm run serve actual running vue-cli-service serve;

The previously run on the 3.0 is the node build / dev-server.js file;

This time we will look at the problem is not on top of it suddenly, scripts and is not configured dev, so console called the [missing script: dev] error;

 

3, summary

npm run xxx, not what you want to run to run, and only in package.json  scripts  configured, you can run, so not all projects npm run dev / build.

To understand what these commands do, it is necessary to execute scripts seen what specific code.

It's like a shortcut to some commands, eliminating input every time a long command (for example, serve the line)

General project will have a build, dev, unit, etc., so named, at least on the basic can tell from the name is doing.

Guess you like

Origin www.cnblogs.com/fxwoniu/p/11353907.html