how to release localhost from Error: listen EADDRINUSE

On Linux (Ubuntu derivatives at least)

killall node

is easier than this form.

ps | grep <something>
kill <somepid>

Neither will work if you have a orphaned child holding the port. Instead, do this:

netstat -punta | grep <port>

If the port is being held you'll see something like this:

tcp           0      0.0.0.0:<port>          0.0.0.*       LISTEN     <pid>/<parent>

Now kill by pid:

kill -9 <pid>

It means the address you are trying to bind the server to is in use. Try another port or close the program using that port.


Run:

ps -ax | grep node

You'll get something like:

60778 ??         0:00.62 /usr/local/bin/node abc.js

Then do:

kill -9 60778