当前位置:网站首页>Introduction to NPM install command

Introduction to NPM install command

2022-06-22 10:28:00 Ah Fei

npm install Introduction to the order

npm install command

npm install (with no args, in package dir)
npm install [<@scope>/]<name>
npm install [<@scope>/]<name>@<tag>
npm install [<@scope>/]<name>@<version>
npm install [<@scope>/]<name>@<version range>
npm install <git-host>:<git-user>/<repo-name>
npm install <git repo url>
npm install <tarball file>
npm install <tarball url>
npm install <folder>

alias: npm i
common options: [-P|--save-prod|-D|--save-dev|-O|--save-optional]
                [-E|--save-exact] [-B|--save-bundle] [--no-save] [--dry-run]

npm install xxx

  • Will be able to X Package installed in node_modules Directory
  • Not modify package.json
  • And then run npm install On command , Will not automatically install X

-g

Global installation

-S, --save

  • Will be able to X Package installed in node_modules Directory
  • Will be in package.json Of dependencies Add... Under properties X
  • And then run npm install On command , It will be installed automatically X To node_modules Directory

-P, --save-prod: Package will appear in yourdependencies

The package will appear in the dependencies . This is the default , Unless it appears -D or -O

The installation package information will be added to devDependencies( Development phase dependencies ), So it's commonly used in the development phase

-D, --save-dev: Package will appear in your devDependencies

The package will appear in your devDependencies in

-O, --save-optional: Package will appear in your optionalDependencies.

The package will appear in optionalDependencies in

–no-save: Prevents saving to dependencies

Prevent saving to dependencies

-E, –save-exact Precisely install the specified module version

Installation package , The latest version will be installed by default

npm install jquery --save-exact  or 
npm install jquery -E

Reference link :https://www.npmjs.cn/cli/install/

原网站

版权声明
本文为[Ah Fei]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221014083762.html