我有一个使用 connect 在 node.js 中运行的简单服务器:
I have a simple server running in node.js using connect:
var server = require('connect').createServer(); //actions... server.listen(3000);在我的代码中,我有实际的处理程序,但这是基本思想.我一直遇到的问题是
In my code I have actual handlers, but thats the basic idea. The problem I keep getting is
EADDRINUSE, Address already in use我的应用程序在之前崩溃或出错后再次运行时收到此错误.由于我没有打开终端的新实例,因此我使用 ctr + z 关闭了进程.
I receive this error when running my application again after it previously crashed or errors. Since I am not opening a new instance of terminal I close out the process with ctr + z.
我相当肯定我所要做的就是关闭服务器或连接.我尝试在 process.on('exit', ...); 中调用 server.close() ,但没有成功.
I am fairly certain all I have to do is close out the server or connection. I tried calling server.close() in process.on('exit', ...); with no luck.
推荐答案我找到了这个解决方案,试试看授予使用权限 sudo
I found this solution, try it Give permission use sudo
sudo pkill node更多推荐
节点/快递:EADDRINUSE,地址已在使用
发布评论