npm install 默认保存 [英] npm install save by default

查看:95
本文介绍了npm install 默认保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装节点模块时忘记添加--save的次数太多了.有没有办法默认附加这个选项?因此,每当我输入 npm install 时,包都会添加到 package.json 中的依赖项中.

It happened too many times that I forgot to add --save when installing node modules. Is there a way to append this option by default? So that whenever I type npm install <package> the package is added to dependencies in package.json.

推荐答案

我发现 npm 有配置标志.设置 save=true 正是我需要的.您可以将其添加到 .npmrc 文件(在用户的主目录中)或调用命令:

I found out that npm has configuration flags. Setting save=true does exactly what I need. You can add it to .npmrc file (in user's home directory) or invoke a command:

npm config set save=true

这篇关于npm install 默认保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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