简体   繁体   English

npm更新依赖问题

[英]npm update dependency issue

I am trying to update dependencies for various projects I have on GitHub. 我正在尝试更新我在GitHub上的各种项目的依赖关系。 I wanted to update them one at a time. 我想一次更新一次。 I went through these steps: 我经历了以下步骤:

  1. npm update (from master) npm更新(来自主服务器)
  2. npm update dependency-name (from folder containing the json files) npm更新依赖项名称(来自包含json文件的文件夹)
  3. npm install dependency-name --save npm install依赖项名称--save
  4. npm fix --force (don't remember this command exactly. It was similar to that) npm fix --force(不完全记得此命令。与之相似)

Then I got a message that said "--force. I hope you know what you're doing." 然后我收到一条消息,说:“-力。希望您知道自己在做什么。” I knew immediately that I'd made a mistake because I didn't know what I was doing. 我立即知道自己犯了一个错误,因为我不知道自己在做什么。 I found that command while Googling solutions, so I stopped there. 我在谷歌搜索解决方案时找到了该命令,所以我在那里停了下来。

How can I update a specific dependency in a package-lock.json file? 如何更新package-lock.json文件中的特定依赖项? Also, could I have done significant damage with the --force command? 另外,我是否可以用--force命令造成重大损失?

Thank you. 谢谢。

--force is a flag which forces a particular operation/process to run So I think to fix the dependencies you would have used npm audit fix --force --force是强制执行特定操作/进程的标志,所以我想修复您将使用npm audit fix --force的依赖项npm audit fix --force

You wouldn't have done any damage to your dependency tree. 您不会对依赖关系树造成任何损害。

The npm docs say: npm audit fix Scan your project for vulnerabilities and automatically install any compatible updates to vulnerable dependencies npm文档说: npm audit fix扫描项目中的漏洞并自动安装任何兼容的更新到易受攻击的依赖项

Please refer https://docs.npmjs.com/cli/audit 请参考https://docs.npmjs.com/cli/audit

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

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