命令是做什么的?

i命令在 npm CLI 中做什么?

我看到它是这样使用的:

npm i package
80342 次浏览

The i flag is an alias for install, so

npm i package

is the same as

npm install package

From the documentation:

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 <alias>@npm:<name>
npm install <git-host>:<git-user>/<repo-name>
npm install <git repo url>
npm install <tarball file>
npm install <tarball url>
npm install <folder>


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

The i command is an alias for npm-install alias, which is mentioned in the docs.

You can use it with all npm-install flags. For example below I will install Angular and live-server using the npm i command:

npm i angular2@2.0.0-alpha.45 -E
npm i live-server -D