npm 执行安装报错

Fix the upstream dependency conflict, or retry

this command with --force or --legacy-peer-deps

to accept an incorrect (and potentially broken) dependency resolution.

原因

主要的原因是 npm7 以上的版本,新增了一个对等依赖的特性,在以前的版本上,只会显示警告,但是还是可以安装成功,然而在新的版本是,npm 安装依赖则会直接报错,无法安装,这也是为了应用更加健壮而加的新的特性吧!

解决方法

如果要保持旧的安装模块方法,可以尝试 npm i 加入 --legacy-peer-deps 参数,这个参数保持跟旧版本一样的安装模块,忽略对等依赖

复制代码
npm i --legacy-peer-deps

除了 --legacy-peer-deps 选项外,还可以使用 --force 饶过冲突

复制代码
npm i --force
相关推荐
anOnion1 小时前
构建无障碍组件之Menu Button pattern
前端·html·交互设计
用户47949283569152 小时前
claude Fable用不了?把Gpt 5.5pro接到你的claude code里
前端·后端
zhangxingchao4 小时前
Kotlin常用的Flow 操作符整理
前端
IT_陈寒6 小时前
React的useState居然还有这种坑?我差点删库跑路
前端·人工智能·后端
Pedantic7 小时前
SwiftUI 手势笔记
前端·后端
橙子家7 小时前
浏览器缓存之【结构化数据库与缓存】: IndexedDB、Cache storage 和 Storage buckets
前端
user20585561518138 小时前
X6 中边悬浮置顶,规避 `mouseleave` 事件丢失问题
前端
李明卫杭州8 小时前
CSS aspect-ratio 属性完全指南
前端
Pedantic10 小时前
SwiftUI 手势层级(Gesture Hierarchy)详解
前端