Port X is already in use
Fahim, encountering the "Port 3000 is already in use" error while running a local server means another process on your machine is using that port. To resolve this, first identify the process using `sudo lsof -i :3000` (Linux) or `Get-NetTCPConnection -LocalPort 3000` (Windows). Then, terminate it with `kill -15 ` (or forcefully with `kill -9 `) on Linux, or `Stop-Process -Id $_.OwningProcess -Force` in Windows.
generated by granite3.2:8b
If you’ve ever encountered the error message “Port 3000 is already in use” when trying to run a local server for your application, you know how frustrating it can be. This error occurs when another process on your machine is using port 3000, which is the default port used by many web servers. Whether you’re a beginner or an experienced developer, the techniques we’ll cover will help you quickly and easily resolve this common issue.
Table of Contents
Find the processes
sudo lsof -i :3000
It will give you the following result (given if any process is running on 3000 port)
COMMAND | PID | NODE | NAME |
---|---|---|---|
node | 56017 | TCP | localhost:hbci (LISTEN) |
Kill
kill -15 \<PID>
If the above step is still not killing the process, I recommend using -9
argument. It kills the process immediately.
For example:
kill -9 56017
Windows
Here’s a simple PowerShell command (run as Admin) that finds and kills all processes using port 3000:
Get-NetTCPConnection -LocalPort 3000 | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force}
Related snippets
- Can’t Redeem DOOM: The Dark Ages in NVIDIA App? Try This Quick Fix May 13, 2025 Trouble claiming DOOM: The Dark Ages in the NVIDIA app? Follow this quick network fix that solves the redemption glitch in minutes.
- Custom Scrollbar Selectors January 23, 2024 Customize scrollbar styles to perfectly match your unique aesthetic.