Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the npm -i flag mean?

What does the i command do in the npm CLI?

I saw it used like this:

npm i package
like image 658
krispy Avatar asked Feb 05 '15 18:02

krispy


People also ask

What is npm INIT flag?

The -y flag when passed to NPM commands tells the generator to use the defaults instead of asking questions. npm init -y. will simply generate an empty npm project without going through an interactive process. The -y stands for yes . More about npm-init here.

What does npm init y?

Description. npm init <initializer> can be used to set up a new or existing npm package. initializer in this case is an npm package named create-<initializer> , which will be installed by npm-exec , and then have its main bin executed -- presumably creating or updating package.

Why npm init is not working?

The Npm command not found error can appear when you install or upgrade npm. On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.


2 Answers

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]
like image 123
MoMoney Avatar answered Oct 13 '22 09:10

MoMoney


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 [email protected] -E
npm i live-server -D
like image 29
Alireza Fattahi Avatar answered Oct 13 '22 10:10

Alireza Fattahi