Error: listen EADDRINUSE: address already in use :::5000

Express.js·Sep 12, 2026·beginner·
Quick answer

Another process is already using the port your server is trying to listen on — often a previous `npm run dev` that didn't fully shut down. Kill the process using that port, or change your server's port in `.env`.

What causes this error

Only one process can listen on a given port at a time. This almost always means a previous instance of your server is still running in the background — a terminal you closed without stopping the process, a crashed process that didn't release the port cleanly, or genuinely a different application using the same port.

The Fix

# Find what's using the port (macOS/Linux)
lsof -i :5000

# Kill it by PID
kill -9 <PID>

# On Windows
netstat -ano | findstr :5000
taskkill /PID <PID> /F

Or sidestep the conflict entirely by changing your port in .env:

PORT=5001

Common causes / variations

  • A previous npm run dev process still running in another terminal tab
  • A crashed process (e.g. from an unhandled exception) that didn't release the port on exit
  • Genuinely running two different projects that both default to the same port

Related errors

See also: Cannot set headers after they are sent to the client.

Was this fix helpful?

Comments

Loading comments...

Fix: EADDRINUSE address already in use (Node/Express) | BugFixer | BugFixer