首页 前端知识 解决npm install时报错Could not resolve dependency

解决npm install时报错Could not resolve dependency

2024-03-15 10:03:32 前端知识 前端哥 434 468 我要收藏

最近在新的项目使用npm install时发现报错:

npm WARN cli npm v9.6.4 does not support Node.js v15.14.0. This version of npm supports the following node versions: `^14.17.0 || ^16.13.0 || >=18.0.0`. You can find the latest version at https://nodejs.org/.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @vue/cli-plugin-eslint@4.5.18
npm ERR! Found: eslint@7.15.0
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"7.15.0" from the root project
npm ERR!   peer eslint@">= 5.0.0" from @vue/eslint-config-prettier@5.1.0   
npm ERR!   node_modules/@vue/eslint-config-prettier
npm ERR!     dev @vue/eslint-config-prettier@"^5.0.0" from the root project
npm ERR!   8 more (babel-eslint, eslint-config-airbnb-base, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@">= 1.6.0 < 7.0.0" from @vue/cli-plugin-eslint@4.5.18
npm ERR! node_modules/@vue/cli-plugin-eslint
npm ERR!   dev @vue/cli-plugin-eslint@"4.5.18" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint@6.8.0
npm ERR! node_modules/eslint
npm ERR!   peer eslint@">= 1.6.0 < 7.0.0" from @vue/cli-plugin-eslint@4.5.18
npm ERR!   node_modules/@vue/cli-plugin-eslint
npm ERR!     dev @vue/cli-plugin-eslint@"4.5.18" 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版本高无法解析依赖树导致依赖下载失败,可执行命令:npm install --legacy-peer-deps,绕过dependency里依赖的进行自动安装,最终问题解决,项目成功运行。

转载请注明出处或者链接地址:https://www.qianduange.cn//article/3842.html
标签
npmnode.js
评论
发布的文章

jQuery之class类操作

2024-04-12 20:04:54

jQuery 菜鸟教程学习

2024-04-12 20:04:22

jQuery

2024-01-31 12:01:10

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!