Several of the difference npm install XXX

Resource use when installing the package npm command, what difference should be noted

npm install X

  • It will Xpackage to the node_modulesdirectory
  • Does not modify thepackage.json
  • After the run npm installcommand is not automatically installedX

npm install X –save

  • It will Xpackage to the node_modulesdirectory
  • It will be in package.jsonthe dependenciesadded property underX
  • After the run npm installcommand is automatically installed Xinto the node_modulesdirectory
  • After the run npm install –productionor specify the NODE_ENVvariable value production, it will automatically install msbuildinto the node_modulesdirectory

npm install X –save-dev

  • It will Xpackage to the node_modulesdirectory
  • It will be in package.jsonthe devDependenciesadded property underX
  • After the run npm installcommand is automatically installed Xinto the directorynode_ 大专栏  几种 npm install XXX 的区别modules
  • After the run npm install –productionor specify the NODE_ENVvariable value productionwhen not installed automatically Xinto node_modulesthe directory

in conclusion:

npm install X npm install X –save npm install X –save-dev
It will Xpackage to the node_modulesdirectory Yes Yes Yes
It will be in package.jsonthe dependenciesadded property underX No Yes Yes
After the run npm installcommand is automatically installed Xinto the node_modulesdirectory No Yes Yes
After the run npm install –productionor specify the NODE_ENVvariable value productionwhen not installed automatically Xinto node_modulesthe directory / Yes No

Guess you like

Origin www.cnblogs.com/lijianming180/p/12346050.html