How to Fix "Error: listen EADDRINUSE: address already in use :::3000" in Node.js & Express
A previous Node.js dev server instance crashed or is still running in the background as a zombie process, occupying TCP port 3000 so the new server cannot bind to it.
Error: listen EADDRINUSE: address already in use :::3000
Quick Fix Checklist
- macOS & Linux 1-liner: npx kill-port 3000 or lsof -ti :3000 | xargs kill -9
- Windows Command Prompt 1-liner: netstat -ano | findstr :3000 followed by taskkill /PID <PID> /F
- Dynamic fallback: configure your server code to listen to process.env.PORT || 3000
- Graceful shutdown handler: listen for SIGTERM and SIGINT to close the HTTP server on termination