我已经在网上搜索过了,但仍然不清楚 npm add <package>
和 npm install --save <package>
之间是否有任何区别。
谢谢。
我已经在网上搜索过了,但仍然不清楚 npm add <package>
和 npm install --save <package>
之间是否有任何区别。
谢谢。
add
只是 install
的别名。
所以唯一的区别在于 --save
,它会修改 package.json
文件中的依赖项。
$ npm add --help
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 <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]
npm add ...
,依赖项(package.json)会被更新。 - syntax-punk