April 18, 2019
Running my node server, I got an error indicating that my port was already in use (
Error: listen EADDRINUSE :::5001).
I knew that shouldn’t have been the case because I had only one application running on that port.
Still, killing the process multiple times from the console didn’t work, so I went in search of the process ID (PID) to kill it specifically.
There are multiple ways to do this, but the one that worked for me out of the box (on Mac) was
lsof which is the “list open files” program.
-i flag allows for inclusion of specific ports.
In my case, I was interested in port
5001, so the command was
lsof -i :5001.
Now when I restarted the server it worked like a charm.
Thanks for reading! My name's Stephen Weiss. I live in Chicago with my wife, Kate, and dog, Finn.
Click here to see the archives of my weeks in review and sign up yourself!