"Port 3000 is already in use": fix it for React, Next.js, Vite and more
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
| Framework | Default port | Message |
|---|---|---|
| Create React App | 3000 | Something is already running on port 3000. |
| Next.js | 3000 | Port 3000 is in use, trying 3001 instead. |
| Vite | 5173 | Port 5173 is in use, trying another one... |
| Express / Node.js | any | Error: listen EADDRINUSE: address already in use :::3000 |
| Django | 8000 | Error: That port is already in use. |
| Rails | 3000 | Address already in use - bind(2) for "127.0.0.1" port 3000 |
| Spring Boot | 8080 | Web 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)Option 2: start on another port
| Framework | How |
|---|---|
| Create React App | PORT=3001 npm start (PowerShell: $env:PORT=3001; npm start) |
| Next.js | next dev -p 3001 |
| Vite | vite --port 5174, or server.port in vite.config. Add strictPort: true to fail instead of switching. |
| Express / Node.js | Read process.env.PORT and start with PORT=3001 |
| Django | python manage.py runserver 8001 |
| Rails | bin/rails server -p 3001 |
| Spring Boot | server.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 | iexLinux / macOS
curl -fsSL https://raw.githubusercontent.com/rpratap2111/portfind/main/install.sh | sh