CodePark/ questions / Sockets, ports & proxies
START PRACTICINGPRACTICE
Backend question · OS, networking & Linux › Sockets, ports & proxies

Starting your server fails with Error: listen EADDRINUSE: address already in use :::3000. What does it mean?

Another socket is already listening on port 3000, often an earlier instance of the app that is still running

Normally only one socket can listen on a given address and port. So a second listen() on the same port fails with EADDRINUSE. Find the process that holds the port with lsof -i :3000 or ss -ltnp.

Why the other options are wrong:

• "Too many clients are connected to port 3000": many connected clients never cause this error.

• "The process lacks permission to bind ports below 1024": that problem gives
EACCES, not EADDRINUSE.
• "A firewall is blocking port 3000": a firewall affects packets, not binding to a port.