portfind

"Port 3000 is already in use": fix it for React, Next.js, Vite and more

Updated

Every dev server reports a busy port a little differently. Find your message below, then either free the port or start on another one.

The message, by framework

FrameworkDefault portMessage
Create React App3000Something is already running on port 3000.
Next.js3000Port 3000 is in use, trying 3001 instead.
Vite5173Port 5173 is in use, trying another one...
Express / Node.jsanyError: listen EADDRINUSE: address already in use :::3000
Django8000Error: That port is already in use.
Rails3000Address already in use - bind(2) for "127.0.0.1" port 3000
Spring Boot8080Web server failed to start. Port 8080 was already in use.

Next.js and Vite quietly move to the next free port. That usually means an old copy of your app is still running on the first one, and your browser may still be showing the old version.

Option 1: free the port

Stop the process that has it. Replace 3000 with your port:

Windows (PowerShell)
Get-NetTCPConnection -LocalPort 3000 -State Listen |
  ForEach-Object { Stop-Process -Id $_.OwningProcess }
macOS / Linux
kill $(lsof -t -iTCP:3000 -sTCP:LISTEN)

Step-by-step guides: Windows, macOS, Linux.

Option 2: start on another port

FrameworkHow
Create React AppPORT=3001 npm start (PowerShell: $env:PORT=3001; npm start)
Next.jsnext dev -p 3001
Vitevite --port 5174, or server.port in vite.config. Add strictPort: true to fail instead of switching.
Express / Node.jsRead process.env.PORT and start with PORT=3001
Djangopython manage.py runserver 8001
Railsbin/rails server -p 3001
Spring Bootserver.port=8081 in application.properties, or --server.port=8081

Know which project is on the port

With several projects open, the question is usually "which one of mine is that?". portfind shows the project folder (from package.json, go.mod, Cargo.toml or the git repo) next to every port, so you kill the right dev server.

Windows (PowerShell)
irm https://raw.githubusercontent.com/rpratap2111/portfind/main/install.ps1 | iex
Linux / macOS
curl -fsSL https://raw.githubusercontent.com/rpratap2111/portfind/main/install.sh | sh