vue npm install出现问题

报错如下:

js 复制代码
ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/three
npm ERR!   peer three@">=0.126.1" from [email protected]
npm ERR!   node_modules/camera-controls
npm ERR!     camera-controls@"^1.33.1" from [email protected]
npm ERR!     node_modules/web-ifc-viewer
npm ERR!       web-ifc-viewer@"^1.0.218" from the root project
npm ERR!   peer three@">= 0.123.0" from [email protected]
npm ERR!   node_modules/web-ifc-viewer/node_modules/three-mesh-bvh
npm ERR!     three-mesh-bvh@"^0.5.11" from [email protected]
npm ERR!     node_modules/web-ifc-viewer
npm ERR!       web-ifc-viewer@"^1.0.218" from the root project
npm ERR!     three-mesh-bvh@"0.5.21" from [email protected]
npm ERR!     node_modules/web-ifc-viewer/node_modules/web-ifc-three
npm ERR!       web-ifc-three@"^0.0.125" from [email protected]
npm ERR!       node_modules/web-ifc-viewer
npm ERR!         web-ifc-viewer@"^1.0.218" from the root project
npm ERR!   2 more (web-ifc-three, the root project)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer three@"^0.135.0" from [email protected]
npm ERR! node_modules/web-ifc-viewer
npm ERR!   web-ifc-viewer@"^1.0.218" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/three
npm ERR!   peer three@"^0.135.0" from [email protected]
npm ERR!   node_modules/web-ifc-viewer
npm ERR!     web-ifc-viewer@"^1.0.218" 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 D:\software\NVM\nodejs\node_cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\software\NVM\nodejs\node_cache\_logs\2024-12-05T07_02_53_925Z-debug-0.log

解决方案

加入--legacy-peer-deps 如我下载npm install dat.gui 改为npm install dat.gui --legacy-peer-deps

原因

在NPM v7中,现在默认安装peerDependencies。

在很多情况下,这会导致版本冲突,从而中断安装过程。

相关推荐
程序猿阿伟6 分钟前
《Flutter社交应用暗黑奥秘:模式适配与色彩的艺术》
前端·flutter
rafael(一只小鱼)9 分钟前
黑马点评实战笔记
前端·firefox
weifont10 分钟前
React中的useSyncExternalStore使用
前端·javascript·react.js
初遇你时动了情14 分钟前
js fetch流式请求 AI动态生成文本,实现逐字生成渲染效果
前端·javascript·react.js
影子信息28 分钟前
css 点击后改变样式
前端·css
几何心凉1 小时前
如何使用 React Hooks 替代类组件的生命周期方法?
前端·javascript·react.js
小堃学编程1 小时前
前端学习(1)—— 使用HTML编写一个简单的个人简历展示页面
前端·javascript·html
hnlucky2 小时前
通俗易懂版知识点:Keepalived + LVS + Web + NFS 高可用集群到底是干什么的?
linux·前端·学习·github·web·可用性测试·lvs
懒羊羊我小弟2 小时前
使用 ECharts GL 实现交互式 3D 饼图:技术解析与实践
前端·vue.js·3d·前端框架·echarts
前端小巷子2 小时前
CSS3 遮罩
前端·css·面试·css3