"Port already in use" means another process is already listening on that port. Find its process ID with netstat -ano | findstr :3000 on Windows or lsof -i :3000 on macOS and Linux, then stop that process or start your program on a different port.
Replace 3000 with your port in every command below.
What the error looks like
Each runtime words it differently, but it is the same operating-system error underneath. These are the exact messages:
| Where | Message |
|---|---|
| Node.js | Error: listen EADDRINUSE: address already in use :::3000 |
| Python on Windows | OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted |
| Python on Linux | OSError: [Errno 98] Address already in use |
| Python on macOS | OSError: [Errno 48] Address already in use |
The numbers differ because each OS assigns its own value to the same error, EADDRINUSE: 98 on Linux, 48 on macOS, and 10048 (WSAEADDRINUSE) on Windows. The :::3000 in the Node message means "every IPv6 and IPv4 address, port 3000".
Find and stop the process on Windows (Command Prompt)
netstat -ano | findstr :3000
Example output:
TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 18244
TCP [::]:3000 [::]:0 LISTENING 18244
The last column is the process ID (PID). -a shows all connections, -n keeps addresses numeric, and -o adds the PID column. findstr :3000 also matches ports such as 30001, so check the port in the second column. To see which program the PID belongs to:
tasklist /FI "PID eq 18244"
Stop it with:
taskkill /PID 18244 /F
/F forces the process to end. If it belongs to another user or a service, you need an elevated (administrator) prompt.
Find and stop the process on Windows (PowerShell)
PowerShell can look the port up directly and returns objects instead of text:
Get-NetTCPConnection -LocalPort 3000 -State Listen | Select-Object LocalAddress, LocalPort, OwningProcess
Example output:
LocalAddress LocalPort OwningProcess
------------ --------- -------------
127.0.0.1 3000 18244
Check the program name, then stop it:
Get-Process -Id 18244
Stop-Process -Id 18244
Both lookups in one line, without typing the PID:
Get-Process -Id (Get-NetTCPConnection -LocalPort 3000 -State Listen).OwningProcess
If no process is listening, Get-NetTCPConnection prints an error saying no matching objects were found. That means the port is free now, and the conflict was with something that has since exited.
Find and stop the process on macOS and Linux (lsof)
lsof -i :3000
Example output:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 51234 alex 23u IPv6 0x9c1e 0t0 TCP *:3000 (LISTEN)
The COMMAND and PID columns tell you what it is. Stop it politely first:
kill 51234
Plain kill sends SIGTERM, which lets the program shut down cleanly. If it is still running a few seconds later, kill -9 51234 sends SIGKILL, which the process cannot ignore or clean up after. If lsof shows nothing but the port is still refused, the process probably belongs to another user: run sudo lsof -i :3000.
To print only the PID (handy in scripts), use lsof -t -i :3000, and to stop whatever holds the port in one step: kill $(lsof -t -i :3000).
Linux without lsof: ss
Many minimal Linux installs don't include lsof, but ss from iproute2 is almost always there:
sudo ss -ltnp 'sport = :3000'
-l lists listening sockets, -t TCP only, -n numeric ports, and -p shows the owning process. The process appears as users:(("node",pid=51234,fd=23)). sudo is needed to see processes that belong to other users.
The usual culprits
- Your own dev server, still running. A terminal tab closed without pressing Ctrl+C, an IDE run configuration, or a watcher that restarted itself. This is the most common cause by far, and it is safe to stop.
- Two projects with the same default port. Many frameworks default to 3000, 5000, 5173 or 8000/8080. Start the second one on another port.
- Docker. A container started with
-p 3000:3000holds the port on the host. On Linux the owning process shows up asdocker-proxy; on Windows and macOS it is Docker Desktop's backend. Stop the container (docker ps, thendocker stop <id>) rather than killing the Docker process. - A system service. Ports such as 80, 443, 5432 (PostgreSQL) and 3306 (MySQL) are often held by installed services. Change your app's port, or stop the service through the system's service manager, not with
kill.
If it still fails
Look the port up again straight after the error. If nothing is listening, your program may be starting two servers itself (for example, calling listen() twice, or a hot-reload tool spawning a second instance), so the second one collides with the first. If something is listening but immediately comes back after you stop it, a supervisor (a service manager, pm2, nodemon, Docker's restart policy) is restarting it. Stop it through that supervisor instead.
Frequently asked questions
- What does EADDRINUSE mean?
- EADDRINUSE is the operating system's 'address already in use' error. A program asked to listen on an IP address and port that another socket is already bound to, so the system refused. The fix is to stop the other process, or start your program on a different port.
- Is it safe to kill the process using a port?
- Check what it is first. If the process is an old copy of your own dev server, stopping it is safe. If it is a system service, a database or something you don't recognise, stopping it can break other software. Use the process ID to look up the program name before killing it.
- Why is the port still busy after I closed the program?
- Usually the program is still running in the background, for example a dev server whose terminal was closed without stopping it, or a child process that outlived its parent. Look the port up again and stop the process ID it shows. On Linux and macOS a socket can also sit briefly in TIME_WAIT after closing; that clears on its own within a couple of minutes.
- How do I just use a different port instead?
- Most dev servers read the port from a setting or environment variable, for example PORT=3001 for many Node frameworks, or a --port flag. Changing the port avoids the conflict without touching the other process.