Skip to main content
nodejsbeginnernetworkingVerified

Node.js EADDRINUSE: Address Already in Use

Last reviewed: 9/14/2026
3 solutions

Exact Error Message

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

Quick Fix

Kill the process using the port or use a different port: lsof -ti:PORT | xargs kill -9

What This Error Means

EADDRINUSE occurs when a Node.js application tries to bind to a port that's already occupied by another process. This commonly happens when a previous instance of the application didn't shut down properly.

Common Symptoms
  • Node.js application fails to start
  • Port binding error message
  • Application crashes on startup
  • Development server conflicts
Common Causes
  • Previous Node.js process still running
  • Another application using the port
  • Process didn't exit cleanly
  • Port conflict in development
  • Multiple instances starting simultaneously
Diagnostic Steps
  1. 1Identify which process is using the port
  2. 2Check if it's your own application
  3. 3Determine if process can be safely terminated
  4. 4Verify no critical services are using the port

Solutions

Solution 1: Kill the conflicting process
  1. 1Find process ID using the port
  2. 2Verify the process can be safely killed
  3. 3Kill the process
  4. 4Restart your application

Commands to Run

Killing processes may cause data loss if they're performing important operations

lsof -ti:PORT | xargs kill -9
netstat -ano | findstr :PORT (Windows)
taskkill /PID PID /F (Windows)
Solution 2: Use a different port
  1. 1Choose an available port
  2. 2Update your application to use the new port
  3. 3Update any configuration files
  4. 4Restart application

Commands to Run

You may need to update load balancers or documentation with the new port

PORT=3001 node app.js
Solution 3: Implement graceful shutdown
  1. 1Add signal handlers in your application
  2. 2Close database connections on shutdown
  3. 3Clean up resources
  4. 4Exit process gracefully
Prevention Tips
  • Implement graceful shutdown in applications
  • Use process managers like PM2
  • Check port availability before starting
  • Use different ports for different environments
  • Clean up zombie processes regularly

Version Notes: Applies to Node.js 14+

Was this helpful?