The difference between i, -g, --save, --save-dev, -D, -S in npm installation (marksheng)

The difference between i, -g, --save, --save-dev, -D, -S in npm installation


Description

 

  • i is short for install
  • -g is a global installation, without -g will be installed in a personal folder
  • Short for -S and --save, the installation package information will be written into dependencies
  • Short for -D and --save-dev, the installation package is written into devDependencies
  • dependencies 与 devDependencies
  • dependencies The dependencies of the production phase, that is, the dependencies of the project when it is running
  • devDependencies The dependencies in the development phase are the dependencies we need during the development process and only work in the development phase


for example

  • When you write ES6 code, you need to convert babel to es5. After the conversion is completed, we only need the converted code. When it goes online, directly deploy the converted code to the production environment. Bebal is not needed, and the production environment does not need it. This can be installed to devDependencies, for example, the code prompt tool can also be installed to devDependencies.
  • If you use Element-UI, you still rely on Element-UI after release to production, so you can install it to dependencies.
     

Guess you like

Origin blog.csdn.net/qq_37430247/article/details/115359086