До основного вмісту

← До всіх статей

A dev server says the port is already in use

Ця стаття поки що доступна лише англійською мовою.

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.

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

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?

  1. Run netstat -ano and find your port.
  2. Match the PID to a program in Task Manager.
  3. Make sure it is a leftover and not something you need.
  4. End that process, then start your server again.

Джерела

  1. How to determine which program uses or blocks specific TCP ports — Microsoft Learn (2026-10-02)

    “Because a program already uses this specific port, another program is prevented from using that same port.”

    https://learn.microsoft.com/en-us/troubleshoot/windows-server/performance/determine-which-program-use-block-tcp-ports

  2. netstat — Microsoft Learn (2026-10-02)

    “Displays active TCP connections and includes the process ID (PID) for each connection.”

    https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/netstat

  3. Find Process ID (PID) in Windows — Microsoft Learn (2026-10-02)

    “From the Processes tab, select Details to see the process ID in the PID column.”

    https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/finding-the-process-id

  4. taskkill — Microsoft Learn (2026-10-02)

    “Ends the specified process and any child processes started by it.”

    https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/taskkill

  5. How to close a pop-up window if Microsoft Edge isn't responding — Microsoft Support (2026-10-02)

    “Under Apps section, right-click Microsoft Edge , and then select End task from the context menu.”

    https://support.microsoft.com/en-us/edge/how-to-close-a-pop-up-window-if-microsoft-edge-isn-t-responding