What does the i
command do in the npm CLI?
I saw it used like this:
npm i package
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.
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.
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.
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 [email protected] -E
npm i live-server -D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With