简体   繁体   English

在NodeJS应用程序中自动更新package.json

[英]Automatically Update the package.json in NodeJS application

I have created the package.json using npm init. 我已经使用npm init创建了package.json。 After some stage I installed few more modules as per the need.Rather than updating the package.json dependencies manually, is there any way to automatically update it?? 经过一些阶段后,我根据需要安装了更多模块。除了手动更新package.json依赖项之外,还有什么方法可以自动更新它?

If I understand what you are asking correctly, you want to use npm to install a dependency and have that dependency automatically added to your package.json ? 如果我正确理解了您的要求,则想使用npm安装依赖项并将该依赖项自动添加到package.json

If so, use --save after the package name : 如果是这样,请在包名称后使用--save

npm install [package name] --save

For download the all packages configured in the package.json , use: 要下载package.json配置的所有软件包,请使用:

npm update --save

Docs: https://docs.npmjs.com/cli/update 文件: https//docs.npmjs.com/cli/update

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM