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。

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

相关推荐
come112345 分钟前
Vue 响应式数据传递:ref、reactive 与 Provide/Inject 完全指南
前端·javascript·vue.js
musk121243 分钟前
electron 打包太大 试试 tauri , tauri 安装打包demo
前端·electron·tauri
万少2 小时前
第五款 HarmonyOS 上架作品 奇趣故事匣 来了
前端·harmonyos·客户端
OpenGL2 小时前
Android targetSdkVersion升级至35(Android15)相关问题
前端
rzl022 小时前
java web5(黑马)
java·开发语言·前端
Amy.Wang2 小时前
前端如何实现电子签名
前端·javascript·html5
海天胜景2 小时前
vue3 el-table 行筛选 设置为单选
javascript·vue.js·elementui
今天又在摸鱼2 小时前
Vue3-组件化-Vue核心思想之一
前端·javascript·vue.js
蓝婷儿2 小时前
每天一个前端小知识 Day 21 - 浏览器兼容性与 Polyfill 策略
前端
百锦再2 小时前
Vue中对象赋值问题:对象引用被保留,仅部分属性被覆盖
前端·javascript·vue.js·vue·web·reactive·ref