You start your development server and it stops with a message like "port 5173 is already in use" or "address already in use". You did not knowingly start anything else.
What this means
A port is a numbered door that a program opens on your PC so other programs can talk to it. Only one program can hold a given port at a time. If one already holds it, Windows does not let another program use it. [R1]
The program holding it is very often an earlier copy of the same server. A server started from a terminal can keep running after you close that terminal window, or after a tool that launched it ended. Nothing is on screen, but the process lives on and keeps the port.
That is why a leftover server can survive a closed terminal, and why starting it a second time fails.
Step 1: Find which process holds the port
Open Command Prompt, and run:
netstat -ano
Each letter does one job. -a includes the ports your PC is listening on [R2]. -n shows numbers rather than names. -o adds the process ID (PID) of the program that owns each line. [R2]
Look for the port number in the Local Address column, with LISTENING in the State column. The number at the end of that line is the PID. On a busy PC the list is long, so you can narrow it:
netstat -ano | findstr :5173
(Change 5173 to your port.)
Step 2: Check what that PID is
Open Task Manager with Ctrl + Shift + Esc. Choose Details, and look for the PID in the PID column. [R3] If the column is not showing, right-click a column heading and choose Select columns.
Read the name. A node.exe or python.exe is typical for a dev server. The name alone does not say which project it belongs to, so a second check is worthwhile: if you have several projects running, make sure this is the one you meant to stop.
Step 3: End that one process
If it is a leftover, you have two ways to end it.
- In Task Manager, right-click it and choose End task. [R5]
- From the command line,
taskkill /pid 12345ends the process (replace the number with the PID). Adding/talso ends the child processes it started. [R4]
A server often has helper processes. If the port is still busy after you end one, run the first command again. A second leftover may be holding it.
What ending it costs. Anything the process held only in memory is gone. For a dev server that is usually harmless. If it is a database, a build, or something you left running on purpose, think first. Also, never end a process whose name you do not recognise, and never end one that belongs to Windows itself.
If it keeps happening
- Stop the server with Ctrl + C in its terminal before you close the window.
- If a tool starts the server for you, close the tool normally rather than ending it from Task Manager.
- If the same port is held by something that comes back every time, it may be a program you installed that has chosen the same port. In that case, change the port your project uses.
Kajlos looks for groups of leftover programs whose parent has gone, and can show you which one is holding a port before you decide what to end. It never ends anything without asking you first.
What should I do now?
- Run
netstat -anoand find your port. - Match the PID to a program in Task Manager.
- Make sure it is a leftover and not something you need.
- End that process, then start your server again.