帮忙看看 eslint 版本报错的问题 ?

作者站长头像
站长
· 阅读数 14
λ npm i cz-customizable --save-dev
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\Administrator\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2023-01-12T11_41_29_452Z-debug-0.log

我要怎么解决?项目仓库地址:https://gitee.com/chanchaw/im...想要发发牢骚,为什么前端没有像 springboot 管理 pom 一样解决版本冲突的功能

回复
1个回答
avatar
test
2024-07-12

Gitee 库没公开,访问受限。建议你直接贴 package.json,其他东西都不重要。

从消息来看,貌似是因为安装的 eslint-plugin-vue 的版本和 @vue/eslint-config-standard 依赖的 eslint-plugin-vue 版本冲突造成的。我根据消息试了这样一个 package.json(部分),可以复现问题。

  "devDependencies": {
    "@vue/eslint-config-standard": "6.1.0",
    "eslint-plugin-vue": "^8.0.3"
  }

既然是版本冲突造成的,你可以尝试把 eslint-plugin-vue 降版本到 ^7.0.0 去,或者把 @vue/eslint-config-standard 升级到 ^7.0.0 去,比如(升级)

  "devDependencies": {
    "@vue/eslint-config-standard": "^7.0.0",
    "eslint-plugin-vue": "^8.0.3"
  }

具体如何决策,需要根据项目的实际情况,毕竟这里只考虑了这两个库的关系。还有其他库的依赖关系可能需要处理。

注:修改了 package.json 之后,最好把 node_modulespackage-lock.json 删掉再重新 npm install

回复
likes
适合作为回答的
  • 经过验证的有效解决办法
  • 自己的经验指引,对解决问题有帮助
  • 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
  • 询问内容细节或回复楼层
  • 与题目无关的内容
  • “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容