webpack5版本下安装webpack-dev-server报错

发布于 2022-09-12 13:38:39 字数 1670 浏览 27 评论 0

我看官网webpack5版本demo例子都有用webpack-dev-server

请问下下面报错是不支持webpack5版本的意思么

macMacBook-Pro:webpack-demo-02 mac$ npm install --save-dev webpack-dev-server
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: webpack@5.10.0
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"*" from clean-webpack-plugin@3.0.0
npm ERR!   node_modules/clean-webpack-plugin
npm ERR!     dev clean-webpack-plugin@"^3.0.0" from the root project
npm ERR!   peer webpack@"^4.27.0 || ^5.0.0" from css-loader@5.0.1
npm ERR!   node_modules/css-loader
npm ERR!     dev css-loader@"^5.0.1" from the root project
npm ERR!   7 more (file-loader, html-webpack-plugin, style-loader, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from webpack-dev-middleware@3.7.2
npm ERR! node_modules/webpack-dev-server/node_modules/webpack-dev-middleware
npm ERR!   webpack-dev-middleware@"^3.7.2" from webpack-dev-server@3.11.0
npm ERR!   node_modules/webpack-dev-server
npm ERR!     dev webpack-dev-server@"*" 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 /Users/mac/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mac/.npm/_logs/2020-12-11T05_33_45_905Z-debug.log

image

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪我鬧 2022-09-19 13:38:39

果然是webpack版本太高的原因,把webpack降到4.27.0版本就可以正常安装webpack-dev-server了

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文