1

Every time I save some changes to the server, nodemon fails to refresh the server with the following error:

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. Any permanent solution so that the server is actually killed and then restarted on refresh?

Anas Nisar
  • 104
  • 7
  • Does this answer your question? [Nodemon: Error: listen EADDRINUSE: address already in use :::5000](https://stackoverflow.com/questions/61181302/nodemon-error-listen-eaddrinuse-address-already-in-use-5000) – JBallin Jul 20 '20 at 04:34
  • No it does not. When i use `node index` , it works a few times but then start giving out the error again. I make sure no other instances are running. It's just ctrl+c doesn't kill the server sometimes. – Anas Nisar Jul 20 '20 at 04:47

2 Answers2

0

I had the same problem as yours.

In my situation, my IDE is VSCode and I use the integrated terminal. The problem is even we close server with Ctrl+C (or Ctrl+Z), the server is actually not stop. So you should close the whole VSCode (or your other IDE) window and reopen it.

Akkien
  • 84
  • 11
  • 1
    That's not a fix. Would just add to the trouble, apart from the agony restarting vs code would bring, I'd have to restart the client and server both now. – Anas Nisar Jul 20 '20 at 05:17
  • Would just kill the whole point of having something like 'nodemon' – Anas Nisar Jul 20 '20 at 05:18
0

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.

Prakash Harvani
  • 1,007
  • 7
  • 18