简体   繁体   English

NPM v7+ - 如何使用“lockfileVersion”安装软件包:1

[英]NPM v7+ - How to install packages with "lockfileVersion": 1

I updated NodeJS to v16, and it ships with NPM v8, so when I install packages, package-lock.json file is created with "lockfileVersion": 2 .我将 NodeJS 更新到 v16,并且它与 NPM v8 一起提供,所以当我安装包时, package-lock.json文件是用"lockfileVersion": 2 package-lock.json "lockfileVersion": 2创建的。 I would like to stay with old format of "lockfileVersion": 1 .我想保留旧格式的"lockfileVersion": 1 Can we install packages in NPM v8, but keep the version of package-lock.json to 1?我们可以在 NPM v8 中安装包,但将package-lock.json的版本保持为 1 吗?

I believe you can find thorough answers to this question at Is there any way to fix package-lock.json lockfileVersion so npm uses a specific format?我相信您可以在Is there any way to fix package-lock.json lockfileVersion so npm using a specific format? . . Using lockfileVersion 2 should be backwards compatible all the way back to at least NodeJS 6+ so im not sure why you would want to use version 1, but if you must there are solutions provided on the linked post.使用 lockfileVersion 2 应该一直向后兼容,至少可以追溯到 NodeJS 6+,所以我不确定您为什么要使用版本 1,但如果必须,链接帖子中提供了解决方案。

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

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