一、问题描述

1、VScode安装依赖包(npm i)报错如下: 报错内容如下:

D:\My Programs\app_demo>npm i

npm ERR! code ERESOLVE

npm ERR! ERESOLVE could not resolve

npm ERR!

npm ERR! While resolving: @vue/eslint-config-standard@6.1.0

npm ERR! Found: eslint-plugin-vue@8.7.1

npm ERR! node_modules/eslint-plugin-vue

npm ERR! dev eslint-plugin-vue@"^8.0.3" from the root project

npm ERR!

npm ERR! Could not resolve dependency:

npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0

npm ERR! node_modules/@vue/eslint-config-standard

npm ERR! dev @vue/eslint-config-standard@"^6.1.0" from the root project

npm ERR!

npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0

npm ERR! node_modules/eslint-plugin-vue

npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0

npm ERR! node_modules/@vue/eslint-config-standard

npm ERR! dev @vue/eslint-config-standard@"^6.1.0" from the root project

npm ERR!

npm ERR! Fix the upstream dependency conflict, or retry

npm ERR! this command with --force, or --legacy-peer-deps

npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

npm ERR!

npm ERR! See C:\Users\PC\AppData\Local\npm-cache\eresolve-report.txt for a full report.

二、解决办法

在安装内容的后面加上

--legacy-peer-deps

三、原因分析

npm版本问题 因为npm7.x以上的版本比npm6.x更严格 解决办法:1、降级为npm6。2、npm i --legacy-peer-deps

四、参考

参考内容1 参考内容2

文章来源

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: