how to release localhost from Error: listen EADDRINUSE how to release localhost from Error: listen EADDRINUSE node.js node.js

how to release localhost from Error: listen EADDRINUSE


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


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.


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>