npm There ------ npm install -S -D -g What is the difference

What is the difference npm install -S -D -g


npm install module_name -S    即    npm install module_name --save    写入dependencies

npm install module_name -D    即    npm install module_name --save-dev 写入devDependencies

npm install module_name -g global mount (using command line)

npm install module_name locally (on the installation package ./node_modules)

 

dependencies and devDependencies What difference does it make?

devDependencies inside the plug-in is used only for development environments, not in production environments

dependencies is the need to publish to the production environment

A bit difficult to understand, do not be afraid, like for example:

You develop a front-end program, you need to use in a project to build gulp your development environment and run locally, then you have to put dependencies in. gulp is used to compress the tools you need to code, packaging, etc., when the program is actually running does not need, put it in dev ok.

You write a program to use element-ui, the production environment to run the project certainly use element-ui, then element-ui should be attached to the dependencies to go.


 

Published 163 original articles · won praise 31 · views 40000 +

Guess you like

Origin blog.csdn.net/COCOLI_BK/article/details/103631500