如何解决npm i下载依赖的时候出现某依赖版本冲突
npm i 下载依赖的时候出现某依赖版本冲突
npm i 下载依赖的时候出现了报错,大概就是版本的问题
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @wangeditor/editor-for-vue@1.0.2
npm ERR! Found: @wangeditor/editor@5.0.1
npm ERR! node_modules/@wangeditor/editor
npm ERR! @wangeditor/editor@"5.0.1" from the root project
npm ERR! peer @wangeditor/editor@">=5.0.0" from @wangeditor/plugin-formula@1.0.11
npm ERR! node_modules/@wangeditor/plugin-formula
npm ERR! @wangeditor/plugin-formula@"^1.0.8" from the root project
npm ERR! 1 more (@wangeditor/plugin-mention)
npm ERR!
解决方法
在npm install 后面加 --legacy-peer-deps,就可以解决了
npm i --legacy-peer-deps
其实这个命令的本身含义就在于让其下载依赖的时候去忽略 依赖间 带来的冲突 (这是我个人的理解哈!)
npm下载报错npm ERR code ERESOLVE
报错:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.7.1
npm ERR! node_modules/eslint-plugin-vue
npm ERR! peer eslint-plugin-vue@"^8.0.1" from @vue/eslint-config-typescript@9.1.0
npm ERR! node_modules/@vue/eslint-config-typescript
npm ERR! dev @vue/eslint-config-typescript@"^9.1.0" from the root project
npm ERR! dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR! dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0
t 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 C:\Users\danxibao\AppData\Local\npm-cache\eresolve-report.txt for a full report.npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\danxibao\AppData\Local\npm-cache\_logs\2022-05-29T07_02_09_565Z-debug-0.log
解决:
- npm下载时
- --legacy-peer-deps
- 在NPM v7中,现在默认安装peerDependencies。
在很多情况下,npm版本问题会导致下载冲突,从而中断安装过程。
–legacy-peer-deps标志是在v7中引入的,目的是绕过peerDependency自动安装;
它告诉 NPM 忽略项目中引入的各个modules之间的相同modules但不同版本的问题并继续安装,保证各个引入的依赖之间对自身所使用的不同版本modules共存。
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
最新评论