Npm安装抛出警告“old lockfile”错误

3

npm 8.1.2 | node 16.13.1

当我使用npm install时,npm会抛出下面的错误,我认为这与版本有关,但不确定,我已安装了npm版本7.19.1,但仍然遇到相同的错误,有什么解决方法吗?

npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the 
future

绝对,谢谢。 - peonola
1个回答

0
这意味着在执行低于7版本的npm安装时创建了package-lock.json文件。 npm 7不仅改变了package-lock.json的格式,还改变了它如何处理同行依赖。当您升级到新的npm版本(>=7)时,请确保使用仍具有旧文件版本的新检出存储库彻底测试所有内容。
如果所有测试都通过,您可以通过提交和推送新格式的package-lock.json来解决问题。

2
请问您能否解释一下如何操作吗? 如果所有测试都通过了,您可以通过提交和推送新格式的package-lock.json来解决问题。 - hrhsii
答案已经解释得很清楚了。切换到npm>=7,运行npm install,然后提交并推送新的package-lock.json文件。 - connexo
1
我也想知道代码。 - Michael Mantion

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接