webpack-dev-server版本错误

错误如下:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webpack5@1.0.0 dev: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webpack5@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output ab
ove.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\gyj\AppData\Roaming\npm-cache\_logs\2019-06-04T11_54_18_787Z-debug.log

原因分析:因为webpack-dev-server版本过高。
解决:
删除:node_modules
重新安装:npm install
安装版本低的webpack-dev-server,如:

npm i webpack-dev-server@2.9.7 -D

如果还有错误,如下:

D:\xampp\htdocs\lianxi\webpack5>npm install webpack-dev-server@2.9.3 -D
npm WARN webpack-dev-server@2.9.3 requires a peer of webpack@^2.2.0 || ^3.0.0 but none is inst
alled. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware@1.12.2 requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 b
ut none is installed. You must install peer dependencies yourself.
npm WARN webpack5@1.0.0 No description
npm WARN webpack5@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted
{"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

原因分析:需要本地安装webpack
如:

npm install webpack@3.8.1 -D
  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值