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
相关推荐
人工智能训练4 小时前
【极速部署】Ubuntu24.04+CUDA13.0 玩转 VLLM 0.15.0:预编译 Wheel 包 GPU 版安装全攻略
运维·前端·人工智能·python·ai编程·cuda·vllm
会跑的葫芦怪5 小时前
若依Vue 项目多子路径配置
前端·javascript·vue.js
pas1368 小时前
40-mini-vue 实现三种联合类型
前端·javascript·vue.js
摇滚侠8 小时前
2 小时快速入门 ES6 基础视频教程
前端·ecmascript·es6
珑墨8 小时前
【Turbo】使用介绍
前端
军军君019 小时前
Three.js基础功能学习十三:太阳系实例上
前端·javascript·vue.js·学习·3d·前端框架·three
打小就很皮...10 小时前
Tesseract.js OCR 中文识别
前端·react.js·ocr
wuhen_n10 小时前
JavaScript内存管理与执行上下文
前端·javascript
Hi_kenyon11 小时前
理解vue中的ref
前端·javascript·vue.js
落霞的思绪12 小时前
配置React和React-dom为CDN引入
前端·react.js·前端框架