其他分享
首页 > 其他分享> > npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock

npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock

作者:互联网

npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I’ll try to do my best with it!报错

 

根据这个报错信息可以得出,目前你电脑npm的版本是适合于lockfileVersion@1的,但是你的package-lock.json是源于lockfileVersion@2的。因为代码中使用的某个插件只能用特定版本的npm下载,所以会报错导致npm install失败。这时就需要升级一下npm。

windows键加 x ,然后按 i 调出power shell页面。然后运行指令
npm install -g npm

升级之后查看一下版本,发现升级到了7.18.1 再试一次

有的错误可能是因为npm版本太高导致的。。。比如这个错

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error Found: [1mhtml-webpack-plugin[22m@[1m4.0.0-alpha[22m[2m[22m

这时需要降级,降级方法

$ sudo npm install npm@4 -g

 

标签:npm,package,lock,lockfileVersion,compatible,报错,install,error
来源: https://www.cnblogs.com/panwudi/p/16439691.html