我一直致力于node js项目,并在localhost:5000
上使用npm start
对其进行测试。每当我想要停止服务器时,我在git bash中使用Ctrl+C
,它会杀死当前进程。但是,上次我做了Ctrl+C
,它可能没有杀死前一个进程,localhost:5000
仍然在工作。我试图关闭git bash终端,但它没有改变任何事情。如果使用npm start
终端重试,将出现以下错误:
events.js:292
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::5000
为什么会出现这种情况?
您可以使用类似ps aux grep node
的内容找到僵尸进程,然后使用sudo kill-9
手动终止该进程,其中
是从ps grep弹出的僵尸节点进程的进程id。