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 WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock._第1张图片
根据这个报错信息可以得出,目前你电脑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 WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock._第2张图片
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock._第3张图片

如图,升级完npm版本之后,即可install成功。


有的错误可能是因为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 WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.)