删除项目下的 node_modules 目录packagelock.json ,重新npm install 解决问题

npm config set registry xxx     —设置npm镜像

npm config is    —-查看使用镜像

npm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolvenpm ERR! npm ERR! While resolving: @vue/eslint-config-standard@6.1.0    npm ERR! Found: eslint-plugin-vue@8.7.1npm ERR! node_modules/eslint-plugin-vuenpm ERR!   dev eslint-plugin-vue@"^8.0.3" from the root projectnpm ERR! npm ERR! Could not resolve dependency:npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0npm ERR! node_modules/@vue/eslint-config-standardnpm ERR!   dev @vue/eslint-config-standard@"^6.1.0" from the root projectnpm ERR!npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0npm ERR!   peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0npm ERR!   node_modules/@vue/eslint-config-standardnpm ERR!     dev @vue/eslint-config-standard@"^6.1.0" from the root projectnpm ERR!npm ERR! Fix the upstream dependency conflict, or retrynpm ERR! this command with --force, or --legacy-peer-depsnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.npm ERR!npm ERR! See C:Users86136AppDataLocalnpm-cacheeresolve-report.txt for a full report. npm ERR! A completlog of thirun cabfound in:

报错原因可能是 :npm 版本问题,npm 的不同版本对不同的组件库等命令不兼容,对命令的要求更严格这里选择下载最新的 npm 解决问题,或者采用如下的解决方案

解决方案一:

通常,最简单的解决方法是将 --legacy-peer-deps 标志传递给 npm,解决指令例如

npm i vant@latest-v2 -S --legacy-peer-deps

  如果这不能立即起作用,也许可以删除node_modulespackage-lock.json。它们将被重新创建

解决方案二:

在指令末尾加上 –force ,例如

npm i vant@latest-v2 -S -force

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注