问题重演
在node退出后,重新node server.js,出现如下报错:
[code]
events.js:66
throw arguments[1]; // Unhandled ‘error’ event
^
Error: listen EADDRINUSE
[/code]
解决办法
Actually, instead of Ctrl + z you should use Ctrl + c which will close the program correctly by sending SIGQUIT 🙂 See the wiki for further details 🙂
也就是说用要关闭node的时候用ctrl+c,而不是用ctrl+z。
此外,如果问题以及出现,可以用如下方法解决。
[code]
ps aux | grep node
kill -9 PID
[/code]
参考:http://stackoverflow.com/questions/4075287/node-express-eaddrinuse-address-already-in-use-kill-server