--save 标志对 npm install 有什么作用 [英] What do the --save flags do with npm install

查看:56
本文介绍了--save 标志对 npm install 有什么作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到安装包的说明

npm install <package_name>

npm install <package_name> --save

npm install <package_name> --save-dev

这些选项有什么区别?

推荐答案

npm install --save 安装包并更新 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 --no-save 安装包,但不更新 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 ---save-dev 更新包中的 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆