node 报错 throw er; // Unhandled 'error' event 解决办法

node 报错

Starting child process with 'node web.js'
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::8000
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at Server.setupListenHandle [as _listen2] (net.js:1355:14)
    at listenInCluster (net.js:1396:12)
    at Server.listen (net.js:1480:7)
    at Object. (C:\Users\Administrator\Desktop\node\node练习\解决异步\web.js:39:4)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
Program node web.js exited with code 1

错误原因:

端口号被占用。

解决方法:

修改端口号,或者干掉端口号,重新启动项目

干掉端口号方法:

1.进入cmd命令窗口,写netstat -ano|findstr "8080"

1215590-20181116143844534-1765934002.png

2.taskkill -PID 13512 -F

1215590-20181116143901503-695659454.png

转载于:https://www.cnblogs.com/vientiane/p/9959148.html

你可能感兴趣的:(node 报错 throw er; // Unhandled 'error' event 解决办法)