--save 标志对 npm install 有什么作用 [英] What do the --save flags do with npm install
问题描述
我看到安装包的说明
npm install <package_name>
或
npm install <package_name> --save
或
npm install <package_name> --save-dev
这些选项有什么区别?
推荐答案
npm install
安装包并更新 package.json 中的依赖项.由于问到这个问题,npm 发生了变化,使得 --save
成为默认选项,因此您不需要使用 --save
来更新依赖.
npm install <package_name> --save
installs the package and updates the dependencies in your package.json. Since this question was asked there was a change to npm, such that --save
has become the default option, so you do not need to use --save
to update the dependencies.
npm install
安装包,但不更新 package.json 中列出的依赖项.
npm install <package_name> --no-save
installs the package but does not update the dependencies as listed in your package.json.
npm install
更新包中的 devDependencies
.这些仅用于本地测试和开发.
npm install <package_name> ---save-dev
updates the devDependencies
in your package. These are only used for local testing and development.
您可以在 https://docs.npmjs.com 阅读更多信息/getting-started/using-a-package.json.
这篇关于--save 标志对 npm install 有什么作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!