npm install X:
- will install the X package into the node_modules directory
- will not modify package.json
- X is not automatically installed when running the npm install command afterwards
npm install X –save:
-
will install the X package into the node_modules directory
-
X will be added under the dependencies property of package.json
-
After running the npm install command, X will be automatically installed in the node_modules directory
-
After running npm install
–production or specifying the value of the NODE_ENV variable as production, msbuild will be automatically installed in the node_modules directory
npm install X –save-dev:
-
will install the X package into the node_modules directory
-
X will be added under the devDependencies property of package.json
-
After running the npm install command, X will be automatically installed in the node_modules directory
-
After running npm install
–production or specifying the value of the NODE_ENV variable as production, X will not be automatically installed in the node_modules directory
Principles of use:
Use --save for packages that need to be used at runtime, otherwise use --save-dev.
Taken from: https://blog.csdn.net/qq_30378229/article/details/78463930