Skip to content

Error: listen eaddrinuse: address already in use: Quick Fix 

  • by
  • 2 min read

Working with any app or piece of code that requires network communication can be complicated, especially if you don’t know much about networking and coding. As these apps tend to use default ports, they can often run into address or port conflicts. 

In this article, we’re talking about the “error: listen eaddrinuse: address already in use” issue, its causes and what you can do to fix the problem. 


What causes this issue?

As you can probably guess by the error message itself, the issue is caused by the Node server using a port that’s already occupied. Since network ports only support one application at a time, multiple apps or servers using a single port can cause trouble. 

Also read: How to fix ‘Err_network_changed’?


How to fix this?

The only solution for this error code is to find the application that’s using the same port as your server, kill it manually and then relaunch the server. Depending on your OS, there are different ways to do this. 

For Windows

If you’re on Windows, open the Task Manager and head over to the Services tab. Once you’re there, find the service that’s using the same port as your server and kill it using the End Task button on the bottom right. Alternatively, you can also right-click the conflicting program and select End Task. You can also do this from the Processes tab.


For Linux/macOS

If you’re on Linux or macOS, the process can be handled through the terminal. Here’s how. 

Step 1: First up, we need to find the program using our server’s port. Run the following command to do so. 

lsof -i tcp:3000

In case you’re searching for a different port, replace TCP in the aforementioned command with the port protocol (TCP or UDP) and the 3000 with the port number. 

Step 2: Note the PID of the program in the aforementioned command, and use it to kill the process. 

kill -9 PID

Of course, be sure to change the PID in the command above to the actual PID of the process you want to kill. The -9 flag is used to ensure that the process is terminated instantly. 

Also read: How to fix Steam service error?

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: yadullahabidi@pm.me.

>
Exit mobile version