Find what is using port 3000 on Windows

Your dev server stops because port 3000 is already in use, or Next.js starts on 3001 instead. First find the process that owns the port. It may be an earlier run of your app, another project, or a service you should leave running.

Find the process on port 3000

Run this in PowerShell. It lists the process listening on port 3000 with its process ID (PID), its name and its full command line, which tells one Node project from another. Windows often lists the same listener twice, once for IPv4 and once for IPv6; this shows each process once.

If it answers "No matching MSFT_NetTCPConnection objects found", nothing is listening on port 3000. The old process may already have exited, so read the server error again and check which port it names.

If CommandLine is empty, the process runs as administrator or as another user: run PowerShell as administrator to see it. A name of wslrelay.exe or com.docker.backend.exe usually means the server runs inside WSL or a Docker container, so stop it there rather than on Windows.

If your dev server says EACCES or permission denied rather than address in use, Windows has reserved the port, often for Hyper-V, WSL or Docker. netsh interface ipv4 show excludedportrange protocol=tcp lists the reserved ranges.

Get-NetTCPConnection -LocalPort 3000 -State Listen |
  Select-Object -ExpandProperty OwningProcess -Unique |
  ForEach-Object { Get-CimInstance Win32_Process -Filter "ProcessId = $_" } |
  Select-Object ProcessId, Name, CommandLine

In Command Prompt

netstat -ano lists every connection with its PID in the last column, and findstr keeps the lines that mention :3000. Look for LISTENING rows whose local address ends in :3000, then find that PID in the Details tab of Task Manager. netstat doesn't show the command line, so use the PowerShell command when you need to know which project it is.

netstat -ano | findstr :3000

Stop it, or move your dev server

Close the app or press Ctrl+C in its terminal when you can. If it is a leftover run of your own app, Stop-Process ends it: replace 1234 with the PID from above. In Command Prompt, taskkill /PID 1234 /F does the same. If the port is still taken afterwards, see the guide "Port still in use after you stop your dev server on Windows".

Leave a process you don't recognize alone and move your dev server instead: change the dev script in package.json to next dev -p 3001 for Next.js or vite --port 3001 for Vite, or run it once with npx, such as npx vite --port 3001. If a script that sets PORT=3001 fails, see the guide "Fix 'PORT' is not recognized as an internal or external command".

Stop-Process -Id 1234

Find it in RepoYard

Open the Machine page, then Ports & processes. RepoYard lists listening processes with their ports, PIDs and command lines, including servers it did not start. Read the command line, and use Stop only when you recognize the process.

Dev servers you start from RepoYard show whether they are running. If port 3000 is taken and RepoYard can pass the port to your dev server, it starts yours on a free port, in PORT or as --port for Vite. Otherwise the start stops and names the program that holds the port. When a stack starts, each dev server gets a free port, and the others can get its address through values such as {api.url}.

RepoYard Machine view lists listening ports, process IDs and command lines with a Stop action for each process.
Inspect the process before stopping it.

Inspect the process before stopping it.

RepoYard Machine view lists listening ports, process IDs and command lines with a Stop action for each process.

On a small screen, scroll across to read the full capture. Open original image

Further reading

Try the workflow in RepoYard.

Windows 10 and 11, x64. Every feature for 7 days, then US$39.99 once. No RepoYard account needed.

Get RepoYard from Microsoft