What does the `npm i` command do?

node.jsNpmTerminalCommand

node.js Problem Overview


What does the i command do in the npm CLI?

I saw it used like this:

npm i package

node.js Solutions


Solution 1 - node.js

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]

Solution 2 - node.js

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionkrispyView Question on Stackoverflow
Solution 1 - node.jsMoMoneyView Answer on Stackoverflow
Solution 2 - node.jsAlireza FattahiView Answer on Stackoverflow