解决10% building modules 7/7 modules 0 activeevents.js:291 throw er; // Unhandled ‘error’ event

npm run dev运行报错如下:

robot@1.0.0 dev C:\Users\xiaomu\Desktop\mySVN\robot
webpack-dev-server –inline –progress –config build/webpack.dev.conf.js

10% building modules 7/7 modules 0 activeevents.js:291
throw er; // Unhandled ‘error’ event
^

Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
Emitted ‘error’ event on Socket instance at:
at emitErrorNT (internal/streams/destroy.js:100:8)
at emitErrorCloseNT (internal/streams/destroy.js:68:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -4077,
code: ‘ECONNRESET’,
syscall: ‘read’
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! robot@1.0.0 dev: webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the robot@1.0.0 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:

我的原因:

1、config 文件中index.js 的 host 之前为了局域网可访问项目,被我改成了0.0.0.0,将其改回localhost或者127.0.0.1再运行项目,是可以正常运行的。不过这样改的话,局域网又访问不了网页,与我目的相悖。

2、最好就是修改端口, 将config 文件中index.js 的prot的8080修改为其他任意端口,再重新运行即可。

总结:原因应该是8080端口被占用了,可修改端口,也可关闭占用该端口的进程。两种方法均可适用

发表评论

电子邮件地址不会被公开。 必填项已用*标注