EADDRINUSE in Node.js — What It Means and How to Fix It

What the Node.js/npm error EADDRINUSE means and how to resolve it.

Published October 24, 2026

EADDRINUSE means your server tried to listen on a port that another process already uses.

What it means and why it happens

Typical causes: a previous server instance still running, two apps using the same port or a crashed process holding it.

Read the full message: it names the file and line where the problem was detected, which is the best place to start.

What you see

run the code
Error: listen EADDRINUSE: address already in use :::3000

Practical examples

Code that triggers it

app.listen(3000)   // 3000 already taken

The fix

const port = process.env.PORT || 3001
app.listen(port)

Find and stop the process

lsof -i :3000
kill $(lsof -t -i :3000)

Common mistakes

  • Starting the app twice.
  • Hard-coding ports.
  • Forgetting dev servers in other terminals.

Key takeaways

  • EADDRINUSE: EADDRINUSE means your server tried to listen on a port that another process already uses.
  • Read the message and the line number first.
  • Fix the cause, don't just silence the error.

FAQ

Use any free port?

listen(0) picks a random free port.

How do I find which line caused EADDRINUSE?

The error message and stack trace show the file and line; start there and work backwards.

More JavaScript articles