npm install 报错 The package-lock.json file was created with an old version of npm, npm WARN o

11 篇文章 1 订阅

1.问题背景

解决方法直接看3
博主在VScode中用 npm install 命令下载包时报错,错误如下

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

changed 1 package, and audited 2 packages in 6s

found 0 vulnerabilities

2.报错原因

npm版本过高,解决方法见第如下,亲测有效可以解决。

3.解决方法

1.在vscode终端中输入如下命令行(可直接复制粘贴)

npm i npm@6 -g

2.然后输入

npm -v

检查npm版本会显示一个低版本的 npm 的版本号。
在这里插入图片描述
3.然后再进行npm install 的操作就不会报错了。

参考博客地址:

https://docker.blog.csdn.net/article/details/120564807?spm=1001.2014.3001.5506

补充遇到的其他问题

  1. 显示 found 0 vulnerabilities 代表这个包已经安装过了,不用再安装,包可以在当前目录中的 node_modues 目录中找到。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值