简体   繁体   English

防止 package.json 更新包

[英]Preventing package.json from updating packages

I wanted to know if there is any clean way of preventing package.json file from updating to latest versions of the dependencies that it contains.我想知道是否有任何干净的方法可以防止 package.json 文件更新到它包含的依赖项的最新版本。

The reason I don't want them to update is because of I need to frequently run few scripts with certain libraries the project contains and if the libraries get updated to latest versions, then I may not be able to validate my tests if some additional transitive dependencies are present.我不希望它们更新的原因是因为我需要经常使用项目包含的某些库运行一些脚本,如果这些库更新到最新版本,那么如果有一些额外的传递,我可能无法验证我的测试存在依赖关系。

Please note: I am not using npm update in any case, but I do use npm install.请注意:无论如何我都没有使用 npm 更新,但我确实使用 npm 安装。

See this answer: https://stackoverflow.com/a/41003507/4236831看到这个答案: https://stackoverflow.com/a/41003507/4236831

You can specify the exact version in your package.json file.您可以在package.json文件中指定确切的版本。

A more detailed overview of managing the versions of your dependencies can be found here: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#dependencies可以在此处找到有关管理依赖项版本的更详细概述: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#dependencies

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

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