This article is a mirror article of machine translation, please click here to jump to the original article.

View: 6771|Reply: 0

The difference between npm i --save and --save -dev

[Copy link]
Posted on 10/8/2018 5:02:08 PM | | |
1.npm install

Modules in dependencies and devDependencies will be downloaded, and only modules in dependencies will be downloaded when using npm install –production or indicating that the NODE_ENV variable value is production.

npm install individual modules: Installed into node_modules directory, but not saved in package.json. When you run the npm install command afterwards, the module will not be installed automatically.

2.npm install --save

Install it in the node_modules directory, save it in the dependencies field in the package.json, and install the modules that depend on the production environment, that is, the modules that are run at the time of the project, such as react, react-dom, jQuery, etc. These modules will be automatically installed into the node_modules when you run npm install, or npm install --production, or indicate that the NODE_ENV variable value is production.

3.npm install --save-dev

Install it in the node_modules directory, save it in the devDependencies field in the package.json, and install the modules that the development environment depends, that is, the modules during project development, such as babel (transcoder, which can convert ES6 code to ES5 code) and other tools, only need to be used in the development environment. Running npm install will automatically install these modules into the node_modules node_modules, but not when running npm install --production or when the NODE_ENV variable value is production.




Previous:【Notice】The website closes the points recharge business
Next:Could not find module "@angular-devkit/build-angular" from
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com