A dev server failing with EADDRINUSE, address already in use or port is already allocated means another process is already listening on that port. Often it’s an old copy of the same server.
Find what’s listening on the port
sudo ss -ltnp 'sport = :3000'State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 511 0.0.0.0:3000 0.0.0.0:* users:(("node",pid=12345,fd=21))lsof -nP -iTCP:3000 -sTCP:LISTENCOMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 12345 you 21u IPv4 0x... 0t0 TCP *:3000 (LISTEN)Get-NetTCPConnection -LocalPort 3000 -State Listen |
Select-Object LocalAddress, LocalPort, OwningProcess,
@{ Name = 'ProcessName'; Expression = { (Get-Process -Id $_.OwningProcess).ProcessName } }LocalAddress LocalPort OwningProcess ProcessName
------------ --------- ------------- -----------
:: 3000 12345 nodeNothing to run on for this part.
Copy the PID into Your values → Process ID. Nothing printed? Then nothing is listening on that port. Check that you have the right port number.
On Linux,
lsof -nP -iTCP:3000 -sTCP:LISTENworks too, iflsofis installed.
Check what that process is
Make sure you’re not about to stop something important, like a database or a system service.
ps -p 12345 -o pid,user,commandGet-Process -Id 12345 | Format-List Id, ProcessName, Path, StartTimeNothing to run on for this part.
Stop it politely
This asks the process to shut down cleanly.
kill 12345
# use: sudo kill 12345 if it belongs to another userStop-Process -Id 12345Nothing to run on for this part.
Force it if it won’t stop
Only use this if the polite stop didn’t work. The process gets no chance to save its work.
kill -9 12345Stop-Process -Id 12345 -ForceNothing to run on for this part.
Confirm the port is free
Run step 1’s command again. No output means the port is free. Now restart your server.
sudo ss -ltnp 'sport = :3000'lsof -nP -iTCP:3000 -sTCP:LISTENGet-NetTCPConnection -LocalPort 3000 -State Listen -ErrorAction SilentlyContinueNothing to run on for this part.
Going further: one-liners
Find and stop whatever is listening on the port in one go. Be careful: this skips step 2’s check.
lsof -t -iTCP:3000 -sTCP:LISTEN | xargs killGet-NetTCPConnection -LocalPort 3000 -State Listen |
ForEach-Object { Stop-Process -Id $_.OwningProcess }Nothing to run on for this part.
Troubleshooting
The process comes straight back: a supervisor is restarting it, such as systemd, Docker, pm2, nodemon or a Windows service. Stop it at that level instead, e.g. docker ps then docker stop <name>, or sudo systemctl stop <service>.
Windows shows PID 0 or 4: that’s the System process (e.g. http.sys, which serves IIS). Don’t kill it. Change your app’s port instead, or stop the Windows service that registered the port.
Operation not permitted / Access is denied: the process belongs to another user. Use sudo (Linux/macOS) or an Administrator PowerShell (Windows).
Sources
Commands checked against these official sources on 4 Nov 2026. Found something out of date? Open an issue.