Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
852 views
in Technique[技术] by (71.8m points)

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

我看官网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: [email protected]
npm ERR! node_modules/webpack
npm ERR!   peer [email protected]"*" from [email protected]
npm ERR!   node_modules/clean-webpack-plugin
npm ERR!     dev [email protected]"^3.0.0" from the root project
npm ERR!   peer [email protected]"^4.27.0 || ^5.0.0" from [email protected]
npm ERR!   node_modules/css-loader
npm ERR!     dev [email protected]"^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 [email protected]"^4.0.0" from [email protected]
npm ERR! node_modules/webpack-dev-server/node_modules/webpack-dev-middleware
npm ERR!   [email protected]"^3.7.2" from [email protected]
npm ERR!   node_modules/webpack-dev-server
npm ERR!     dev [email protected]"*" 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...