当前位置: 代码网 > it编程>前端脚本>Vue.js > 如何解决npm i下载依赖的时候出现某依赖版本冲突

如何解决npm i下载依赖的时候出现某依赖版本冲突

2024年05月18日 Vue.js 我要评论
npm i 下载依赖的时候出现某依赖版本冲突npm i 下载依赖的时候出现了报错,大概就是版本的问题npm err! code eresolvenpm err! eresolve unable to

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共存。

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com