How To Fix “Error: listen EADDRINUSE: address already in use :::8001” in Nodejs

Problem

This error occurs in your nodejs project when you have a project that did not shut down properly. It will leave the port still running and used, so if you try to run again your Nodejs project you will get this error

Solutions

Method 1

First, we need to find the PID of the port associated with it. To find that we need to run this command:

sudo lsof -i :<port_number>

Then, we can now kill the process by using this command:

kill -9 <PID>

Method 2

We can also use the command for killing all the node process, to do that enter this command:

  • killall node
  • pkill node

Reference
https://levelup.gitconnected.com/how-to-kill-server-when-seeing-eaddrinuse-address-already-in-use-16c4c4d7fe5d
https://www.codegrepper.com/code-examples/whatever/Error%3A+listen+EADDRINUSE%3A+address+already+in+use+%3A%3A%3A80

Leave a Comment

Your email address will not be published. Required fields are marked *