[英]Error: listen EADDRINUSE: address already in use :::5000
Every time I save some changes to the server, nodemon fails to refresh the server with the following error:每次我将一些更改保存到服务器时,nodemon 都无法刷新服务器,并出现以下错误:
Error: listen EADDRINUSE: address already in use :::5000
I've been using sudo lsof -i:5000
and then kill -9 [PID]
to resolve it but I've to do it every 2 mins or so.我一直在使用
sudo lsof -i:5000
然后kill -9 [PID]
来解决它,但我必须每 2 分钟左右执行一次。 Any permanent solution so that the server is actually killed and then restarted on refresh?任何永久解决方案,以便服务器实际上被杀死然后在刷新时重新启动?
I had the same problem as yours.我遇到了和你一样的问题。
In my situation, my IDE is VSCode and I use the integrated terminal .在我的情况下,我的 IDE 是 VSCode,我使用集成终端。 The problem is even we close server with Ctrl+C (or Ctrl+Z), the server is actually not stop.
问题是即使我们用 Ctrl+C(或 Ctrl+Z)关闭服务器,服务器实际上并没有停止。 So you should close the whole VSCode (or your other IDE) window and reopen it.
因此,您应该关闭整个 VSCode(或您的其他 IDE)window 并重新打开它。
try this two command in Terminal-在终端中尝试这两个命令-
sudo sysctl fs.inotify.max_user_watches=582222 && sudo sysctl -p
sudo sysctl fs.inotify.max_user_watches=582222
I hope will help you.我希望能帮助你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.