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
其他依赖包版本操作类似