Vue报错 events.js:174 throw er; // Unhandled 'error' event

> [email protected] dev C:\Users\MaMing\Desktop\demo\Vue-webpack-study
> webpack-dev-server --open --port 3000 --host 127.0.0.1 --hot

events.js:174
throw er; // Unhandled ‘error’ event
^

Error: listen EACCES: permission denied 127.0.0.1:3000
at Server.setupListenHandle [as _listen2] (net.js:1262:19)
at listenInCluster (net.js:1327:12)
at doListen (net.js:1460:7)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Emitted ‘error’ event at:
Emitted ‘error’ event at:
at emitErrorNT (net.js:1306:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
[… lines matching original stack trace …]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: webpack-dev-server --open --port 3000 --host 127.0.0.1 --hot
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! D:\Node\node_cache_logs\2020-04-18T02_28_45_829Z-debug.log
Vue报错 events.js:174 throw er; // Unhandled 'error' event_第1张图片

这种情况是我们重启以后,DHCP重新分配了IP,重新分配地址即可

  • 方法一:
  1. 打开cmd,命令行运行 ipconfig,得到本机的ip地址
  2. 打开config文件夹下的index.js,将host的值改为我上一步所得到的ipv4即可

、、

  • 方法二:
  1. 如果怕麻烦可以直接打开package.json,找到“script”
  2. 找到“dev”
    ![在这里插入图片描述](https://img-blog.csdnimg.cn/20200418111708225.png
  3. 把端口改一下即可(如下:)
    Vue报错 events.js:174 throw er; // Unhandled 'error' event_第2张图片

Vue报错 events.js:174 throw er; // Unhandled 'error' event_第3张图片

mmp找了一整天,终于找到原因了!

你可能感兴趣的:(前端,vue,报错)