03_nodejd_npm install报错

npm install报错

js 复制代码
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: 5kcrm@11.0.0
npm ERR! Found: vue@2.5.17
npm ERR! node_modules/vue
npm ERR!   vue@"2.5.17" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^2.6.0" from @chenfengyuan/vue-qrcode@1.0.2
npm ERR! node_modules/@chenfengyuan/vue-qrcode
npm ERR!   @chenfengyuan/vue-qrcode@"^1.0.2" 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!
npm ERR! For a full report see:

4.报错原因

在新版本的npm中,默认情况下,npm install遇到冲突的peerDependencies时将失败。

5.解决办法

使用--force或--legacy-peer-deps可解决这种情况。

复制代码
    --force 会无视冲突,并强制获取远端npm库资源,当有资源冲突时覆盖掉原先的版本。

    --legacy-peer-deps标志是在v7中引入的,目的是绕过peerDependency自动安装;它告诉         NPM 忽略项目中引入的各个modules之间的相同modules但不同版本的问题并继续安装,保            证各个引入的依赖之间对自身所使用的不同版本modules共存。

建议用--legacy-peer-deps 比较保险一点

在终端输入

js 复制代码
npm install --legacy-peer-deps
相关推荐
qzhqbb12 分钟前
Web 服务器(Nginx、Apache)
服务器·前端·nginx
天若有情67315 分钟前
前端进阶必看:吃透这些高阶知识,告别CRUD,迈向高级前端工程师
前端·状态模式
coderYYY44 分钟前
git push报错Authentication failed for ‘xxx’也不会弹要求输入用户名密码的最终解决方法
前端·git·gitee·github
l1t1 小时前
QWen 3.5plus总结的总结基准测试结果的正确方法
前端·数据库
kyriewen112 小时前
为什么我的代码在测试环境跑得好好的,一到用户电脑就崩?原来凶手躲在地址栏旁边
开发语言·前端·javascript·chrome·ecmascript·html5
小北方城市网2 小时前
JavaScript 实战 —— 实现一个简易的 TodoList(适合前端入门 / 进阶)
开发语言·前端·javascript
是上好佳佳佳呀2 小时前
【前端(二)】CSS 知识梳理:从编写位置到选择器优先级
前端·css
倾颜2 小时前
我是怎么把单 Tool Calling 升级成多 Tool Runtime 的
前端·后端·langchain
清汤饺子2 小时前
Superpowers:给 AI 编程 Agent 装上"工程化超能力"
前端·javascript·后端
踩着两条虫2 小时前
AI驱动的Vue3应用开发平台 深入探究(十三):物料系统之区块与页面模板
前端·vue.js·人工智能·架构·系统架构