webpack运行报错: npm ERR! Failed at the [email protected] dev script

报错信息:

PS E:\PersonalBlog\ui> yarn start
yarn run v1.16.0

> [email protected] dev E:\PersonalBlog\ui
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     G:\Program Files\nodejs\node_cache\_logs\2020-05-02T10_36_40_990Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
webpack运行报错: npm ERR! Failed at the ui@1.0.0 dev script_第1张图片

遇到这个问题,查了一些资料,发现我这边造成这个问题的原因是webpack 和webpack-dev-server版本不匹配造成的:
参考网址:https://www.jianshu.com/p/732020992dde
https://www.npmjs.com/package/webpack-dev-server
https://blog.csdn.net/lizhen_software/article/details/84073468

webpack 3.x 要使用 webpack-dev-server 2.x
webpack 4.x 要使用 webpack-dev-server 3.x
    "webpack": "^3.6.0",
    "webpack-dev-server": "^2.6.0",
webpack运行报错: npm ERR! Failed at the ui@1.0.0 dev script_第2张图片

如果觉得文章写得还行,请点个赞。如果想与我进一步交流,可以关注我的公众号或者加我的微信。

webpack运行报错: npm ERR! Failed at the ui@1.0.0 dev script_第3张图片
个人微信

webpack运行报错: npm ERR! Failed at the ui@1.0.0 dev script_第4张图片
公众号_前端微说.jpg

你可能感兴趣的:(webpack运行报错: npm ERR! Failed at the [email protected] dev script)