Resolving EADDRINUSE Error: How to Free Up Ports in Node.js

Posted by






How to Fix Error: listen EADDRINUSE in Node.js

How to Fix Error: listen EADDRINUSE in Node.js

If you are a Node.js developer, you may have encountered the error “Error: listen EADDRINUSE: address already in use”. This error occurs when you try to start a server on a port that is already in use by another process.

Here’s how you can fix this error:

  1. Identify the process using the port
  2. You can use the following command to identify the process using the port:

    lsof -i :

    Replace with the port number that is already in use. This command will show you the process ID (PID) using the port.

  3. Kill the process using the port
  4. Once you have identified the process using the port, you can use the following command to kill the process:

    kill -9

    Replace with the process ID that you obtained from the previous command. This will terminate the process using the port.

  5. Rerun your Node.js server
  6. After killing the process using the port, you can now rerun your Node.js server. It should now start without any issues.

By following these steps, you can fix the “Error: listen EADDRINUSE: address already in use” in Node.js and continue developing your applications without any interruptions.


0 0 votes
Article Rating
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
ABHINAV
7 months ago

how to do the same on windows os ???
running in terminal but the commands doesnt exist in windows terminal

Manzeel Uprety
7 months ago

Thank you

Sara Binsanad
7 months ago

What is the name of the program used for the commands