npm v6.x 更新
现在您可以使用npm i 或npm i -S 或npm i -P 之一来安装模块并将其保存为依赖项。
npm i是npm install的别名
-
npm i 等于npm install,表示默认保存模块为
依赖;
-
npm i -S 等于 npm install --save (npm v5-)
-
npm i -P 等于 npm install --save-prod (npm v5+)
检查你的 npm 版本
$ npm -v
6.14.4
获取 npm 帮助
➜ ~ npm -h
Usage: npm <command>
where <command> is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
clean-install, clean-install-test, completion, config,
create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
edit, explore, fund, get, help, help-search, hook, i, init,
install, install-ci-test, install-test, it, link, list, ln,
login, logout, ls, org, outdated, owner, pack, ping, prefix,
profile, prune, publish, rb, rebuild, repo, restart, root,
run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami
npm <command> -h quick help on <command>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
/Users/xgqfrms-mbp/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@6.14.4 /Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/lib/node_modules/npm
获取 npm 安装帮助
npm -h i/npm help install
$ npm -h i
npm install (with no args, in package dir)
npm install [<@scope>/]<pkg>
npm install [<@scope>/]<pkg>@<tag>
npm install [<@scope>/]<pkg>@<version>
npm install [<@scope>/]<pkg>@<version range>
npm install <alias>@npm:<name>
npm install <folder>
npm install <tarball file>
npm install <tarball url>
npm install <git:// url>
npm install <github username>/<github project>
aliases: i, isntall, add
common options: [--save-prod|--save-dev|--save-optional] [--save-exact] [--no-save]
➜ ~
参考
https://docs.npmjs.com/cli/install