升级webpack5版本遇到的一些问题

复制代码
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: jjj_shop_web@1.0.0
npm ERR! Found: webpack@5.91.0
npm ERR! node_modules/webpack
npm ERR!   dev webpack@"^5.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from friendly-errors-webpack-plugin@1.7.0
npm ERR! node_modules/friendly-errors-webpack-plugin
npm ERR!   dev friendly-errors-webpack-plugin@"^1.7.0" 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 D:\npm\node_cache\eresolve-report.txt for a full report

升级webpack版本遇到的一些问题,这个问题是由于在你的项目中使用了 webpack 5.91.0,但是 friendly-errors-webpack-plugin 插件需要的是 webpack 版本 "^2.0.0 || ^3.0.0 || ^4.0.0"。这导致了依赖冲突,npm 无法解析依赖树。

解决办法:

只能一步步来检查是哪个依赖包版本不兼容,可以使用npm show来检测可用版本,然后再次更新

复制代码
npm show uglifyjs-webpack-plugin versions

其他依赖包版本操作类似

相关推荐
是烟花哈1 天前
【前端】React框架学习
前端·学习·react.js
qq4356947011 天前
JavaWeb08
前端
2401_878454531 天前
html和css的复习(1)
前端·css·html
@PHARAOH1 天前
WHAT - git worktree 概念
前端·git
IT_陈寒1 天前
我竟然被JavaScript的隐式类型转换坑了三天!
前端·人工智能·后端
我亚索贼六丶1 天前
二十六. AI基础概念之如何更好的使用AI
前端
小码哥_常1 天前
安卓启动页Logo适配秘籍:告别“奇形怪状”的展示
前端
我亚索贼六丶1 天前
二十五.Electron 初体验与进阶
前端
当时只道寻常1 天前
像使用 Redis 一样操作 LocalStorage
前端·前端工程化
RONIN1 天前
UI组件库elementplus
前端