StackDevLife
1-Min FixBeginnerNode.js, Debugging, Development

Fix Port Already in Use Error Instantly

~1 min read
TL;DR

Quickly free up a busy port and restart your server without wasting time debugging.

If you see an error like "Port 3000 is already in use", it means another process is using that port.

On Mac or Linux, run:
lsof -i :3000

This will show the process ID (PID). Then kill it:
kill -9 <PID>

On Windows, run:
netstat -ano | findstr :3000

Then kill the process:
taskkill /PID <PID> /F

Alternatively, you can start your app on a different port:
PORT=3001 npm start

This issue usually happens when a previous server process did not shut down properly. Always stop your server cleanly using Ctrl + C.

Node.jsDebuggingPortFix

Get a new 1-Min Fix in your inbox

Subscribe to Stack Dev Life — free, no spam, unsubscribe anytime.

Subscribe free →