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
相关推荐
半兽先生20 分钟前
告别 AI 乱写 Vue!用 vue-skills 构建前端智能编码标准
前端·vue.js·人工智能
前端达人1 小时前
都2026年了,还在用Options API?Vue组合式API才是你该掌握的“正确姿势“
前端·javascript·vue.js·前端框架·ecmascript
Dxy12393102161 小时前
Python检查JSON格式错误的多种方法
前端·python·json
chao-Cyril2 小时前
从入门到进阶:前端开发的成长之路与实战感悟
前端·javascript·vue.js
shalou29012 小时前
Spring 核心技术解析【纯干货版】- Ⅶ:Spring 切面编程模块 Spring-Instrument 模块精讲
前端·数据库·spring
大时光2 小时前
js 封装 动画效果
前端
大时光2 小时前
html翻页时钟 效果
前端
大猫子的技术日记2 小时前
2025 AI Agent 开发实战指南:从上下文工程到多智能体协作
前端·人工智能·bootstrap
前端达人2 小时前
被JavaScript忽视的Web Animations API:为什么说它是前端动画的真正未来?
开发语言·前端·javascript·ecmascript
忧郁的橙子.3 小时前
04-从零搭建本地AI对话系统:Ollama + DeepSeek-R1:7B + Streamlit
前端·chrome