vue npm install出现问题

报错如下:

js 复制代码
ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: web-ifc-viewer@1.0.218
npm ERR! Found: three@0.149.0
npm ERR! node_modules/three
npm ERR!   peer three@">=0.126.1" from camera-controls@1.38.2
npm ERR!   node_modules/camera-controls
npm ERR!     camera-controls@"^1.33.1" from web-ifc-viewer@1.0.218
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 three-mesh-bvh@0.5.21
npm ERR!   node_modules/web-ifc-viewer/node_modules/three-mesh-bvh
npm ERR!     three-mesh-bvh@"^0.5.11" from web-ifc-viewer@1.0.218
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 web-ifc-three@0.0.125
npm ERR!     node_modules/web-ifc-viewer/node_modules/web-ifc-three
npm ERR!       web-ifc-three@"^0.0.125" from web-ifc-viewer@1.0.218
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 web-ifc-viewer@1.0.218
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: three@0.135.0
npm ERR! node_modules/three
npm ERR!   peer three@"^0.135.0" from web-ifc-viewer@1.0.218
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。

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

相关推荐
没有鸡汤吃不下饭10 分钟前
Git将某个分支合并到开发(dev)、测试(test)后突然想撤销该分支的功能,怎么处理?
前端·git·github
文心快码BaiduComate11 分钟前
Comate分饰多角:全栈开发一个Python学习网站
前端·后端·python
90后的晨仔18 分钟前
Vue 插槽(Slots)全面解析与实战指南
前端·vue.js
我是日安21 分钟前
从零到一打造 Vue3 响应式系统 Day 20 - Reactive:reactive 极端案例
前端·vue.js
Slice_cy23 分钟前
📚 uniapp版本懒加载 + 不定高虚拟列表实现
前端
golang学习记24 分钟前
从0死磕全栈之Next.js API 路由实战:不用后端,前端也能写接口!
前端
Nathan2024061626 分钟前
Kotlin-Sealed与Open的使用
android·前端·面试
MQliferecord28 分钟前
前端性能优化实践经验总结
前端
Proselyte28 分钟前
暗色模式看这一篇就够了
前端
RoyLin32 分钟前
SurrealDB - 统一数据基础设施
前端·后端·typescript