首页 前端知识 npm依赖冲突如何解决

npm依赖冲突如何解决

2025-03-20 12:03:55 前端知识 前端哥 882 836 我要收藏

报错:

npm install --save @vue-office/excel npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: ruoyi@3.8.7 npm ERR! Found: webpack@4.47.0 npm ERR! node_modules/webpack npm ERR! peer webpack@"^4.0.0" from @intervolga/optimize-cssnano-plugin@1.0.6 npm ERR! node_modules/@intervolga/optimize-cssnano-plugin npm ERR! @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/cli-service@4.4.6 npm ERR! node_modules/@vue/cli-service npm ERR! peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.4.6 npm ERR! node_modules/@vue/cli-plugin-babel npm ERR! dev @vue/cli-plugin-babel@"4.4.6" from the root project npm ERR! 4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...) npm ERR! peer webpack@"^4.0.0 || ^5.0.0" from @soda/friendly-errors-webpack-plugin@1.8.1 npm ERR! node_modules/@soda/friendly-errors-webpack-plugin npm ERR! @soda/friendly-errors-webpack-plugin@"^1.7.1" from @vue/cli-service@4.4.6 npm ERR! node_modules/@vue/cli-service npm ERR! peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.4.6 npm ERR! node_modules/@vue/cli-plugin-babel npm ERR! dev @vue/cli-plugin-babel@"4.4.6" from the root project npm ERR! 4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...) npm ERR! 23 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! dev html-webpack-plugin@"^5.6.3" from the root project npm ERR! npm ERR! Conflicting peer dependency: webpack@5.97.1 npm ERR! node_modules/webpack npm ERR! peerOptional webpack@"^5.20.0" from html-webpack-plugin@5.6.3 npm ERR! node_modules/html-webpack-plugin npm ERR! dev html-webpack-plugin@"^5.6.3" 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! See C:\Users\Administrator\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\Administrator\AppData\Local\npm-cache\_logs\2024-12-27T07_18_47_051Z-debug-0.log

使用 --legacy-peer-deps 安装(推荐)

--legacy-peer-deps 标志会忽略对 Peer Dependencies 的严格检查,这样可以避免版本冲突,并让安装继续进行。可以尝试以下命令:

npm install --save @vue-office/excel --legacy-peer-deps
复制

转载请注明出处或者链接地址:https://www.qianduange.cn//article/24177.html
标签
评论
发布的文章

【Linux笔记】基础IO(上)

2025-03-27 13:03:40

大家推荐的文章
会员中心 联系我 留言建议 回顶部
浏览器升级提示:您的浏览器版本较低,建议您立即升级为知了极速浏览器,极速、安全、简约,上网速度更快!立即下载
复制成功!