Fix "port 3000 is already in use" on Windows
You start your dev server and see:
Error: listen EADDRINUSE: address already in use :::3000Something else is using the port. Often it is an old copy of the same server that never closed. Devpit finds it and stops it, after you say yes.
Open it from the main menu with 2, or choose Fix Stuck Ports & Apps. The section has three tools.
Kill a port
Section titled “Kill a port”Use this when you know the port number.
-
Choose Kill a port.
-
Type the port number, for example
3000. Digits only, from 1 to 65535. -
Press Enter.
-
Devpit shows who is listening: the protocol, address, PID and program name.
-
Read the question, for example “Kill node.exe (PID 12345) on port 3000?”. The default answer is No.
-
Press y to stop it.
-
Devpit waits up to two seconds and then tells you “Port 3000 is free”, or that it is still busy.
If nobody is using the port, Devpit says “Port 3000 is already free”. Then the error came from something else, such as a firewall or a typo in your config.
Kill the whole process tree
Section titled “Kill the whole process tree”Dev servers are often started by another program.
If Devpit sees that the parent is npm, pnpm, yarn, node, cmd or PowerShell, it shows an extra option:
[t] Kill process tree (also stops 2 other process(es) started by npm.exe)Press t to switch it on before you answer. This stops the parent and everything it started. Use it when the server keeps coming back after you kill it.
Busy dev ports
Section titled “Busy dev ports”Use this when you do not know which port is stuck.
- Choose Busy dev ports.
- Devpit checks every port on your dev list and shows the ones in use, with the PID, program and parent program.
- Move with ↑ ↓ and mark rows with Space.
- Press k to kill the marked ones. Answer the question.
- Press r to refresh the list.
The default list is 3000 to 3010, 4200, 5000, 5173, 5174, 8000, 8080, 8081, 8888, 9000 and 19000 to 19006 (the Expo range). You can change it in Settings.
Node processes
Section titled “Node processes”Use this to find stuck node, npm, pnpm and yarn programs that may not hold a port at all.
- Choose Node processes.
- Mark the ones to stop with Space.
- Press k and answer the question.
What Devpit will never stop
Section titled “What Devpit will never stop”Some processes are protected. Devpit shows a reason instead of a tick box and you cannot select them:
- PID 0 and PID 4 (the Windows System process),
- Windows services,
- every other program that lives in
C:\Windows\System32.
The shells cmd.exe, powershell.exe and conhost.exe are the exception.
They are not services, and dev tools start them constantly, so Devpit lets you stop them, mostly as part of a process tree.
| Key | What it does |
|---|---|
| ↑ ↓ | Move |
| Enter | Choose a tool, or check the port you typed |
| Space | Mark or unmark a row |
| k | Kill the marked rows |
| t | Turn “kill process tree” on or off, when it is offered |
| r | Refresh the list |
| y / n | Answer the question (No is the default) |
| Esc | Go back |
You can click rows and use the mouse wheel too. See Keyboard and mouse.
If Devpit says “needs admin”
Section titled “If Devpit says “needs admin””Windows only lets you stop a program that runs with the same or lower rights than you. If the program was started as administrator, Devpit shows “needs admin” and does not stop it. Devpit does not raise its own rights for this.
- Close the app the normal way, in its own window, or
- Open a terminal as administrator, run
devpitthere, and try again.
Safety
Section titled “Safety”Nothing is stopped without your confirmation, and the default answer is No. Devpit stops only the processes you picked. Stopping a program ends it right away, so save your work first. Dev servers can usually just be started again.
Common questions
How do I fix port 3000 is already in use on Windows?
Open Devpit, choose Fix Stuck Ports and Apps, choose Kill a port, type 3000 and press Enter. Devpit shows which app holds the port. Press y to stop it. Then start your dev server again.
Can Devpit kill any process?
No. Devpit refuses to stop PID 0 and 4, Windows services, and other programs that live in the Windows System32 folder. It shows the reason instead of a tick box. The shell programs cmd, PowerShell and conhost are the exception, because dev tools start them all the time.
What does Kill process tree do?
A dev server is often started by another program such as npm, pnpm, yarn, node, cmd or PowerShell. If you kill only the server, its parent can start it again. Kill process tree also stops the parent and everything it started.
Devpit says it needs admin. What now?
Windows refused to let Devpit stop that process because it runs with higher rights. Devpit does not raise its own rights for this. Close the app in its own window, or run Devpit from a terminal that was opened as administrator.
Which ports does Busy dev ports check?
3000 to 3010, 4200, 5000, 5173, 5174, 8000, 8080, 8081, 8888, 9000 and the Expo range 19000 to 19006. You can change the list in Settings.
