Cameron the Dev

How to fix Error: listen EADDRINUSE: address already in use :::3000

October 04, 2020

If you are running into the error Error: listen EADDRINUSE: address already in use :::3000 when trying to start your application then the line below will fix it. If you are seeing a different port number in the error then switch out that number in the line below.

The line that will fix the issue:

kill -9 $(lsof -i TCP:3000 | grep LISTEN | awk '{print $2}')

The command above finds the process id that is listening on port 3000 and sends the SIGKILL signal to the process which will terminate the process even if it is unresponsive or frozen.

How does the error happen?

This error happens when you have another application that is currently listening on this port. For myself, this is normally another service I have started that hasn’t shut down correctly or I have running in another terminal tab that I have forgotten about.