Introduction
Have you ever run into the frustrating issue where a port is already in use, blocking you from starting your app? Manually finding and killing processes is time-consuming. Thatβs why I built kill-my-port
, a simple CLI tool that helps you instantly free up any port with just one command!
Why kill-my-port
?
When working with Node.js, React, Next.js, Express, Django, or any server-based app, you might encounter errors like:
Error: listen EADDRINUSE: address already in use :::3000
Instead of manually searching for processes and killing them, kill-my-port
does the job for you instantly.
π Key Features:
β
Find & Kill processes by port automatically
β
Works on Windows, macOS, and Linux
β
Lists all active ports if no port is provided
β
Fast, simple, and efficient
Installation & Usage
π₯ Quick Start (No Installation Required)
If you donβt want to install anything, just run:
npx kill-my-port 3000
This will instantly find and kill any process using port 3000
.
π οΈ Global Installation
For frequent use, install it globally:
npm install -g kill-my-port
Now, you can use it anytime:
kill-my-port 3000
π List Active Ports
If you donβt know which port is causing the issue, simply run:
kill-my-port
It will display all active ports, allowing you to choose which one to kill.
How It Works
Under the hood, kill-my-port
runs platform-specific commands:
-
Windows: Uses
netstat
&taskkill
to find and terminate processes. -
macOS/Linux: Uses
lsof
&kill -9
to achieve the same.
Example Usage
Letβs say your React app wonβt start because port 5173 is already in use. Just run:
kill-my-port 5173
Youβll see:
β Kill process running on port 5173? (y/n): y
β
Port 5173 has been freed.
Now, restart your app without issues! π
Where to Get It
π GitHub: https://github.com/TenEplaysOfficial/kill-my-port
π¦ npm: https://www.npmjs.com/package/kill-my-port
Give it a try and let me know what you think! π
Top comments (0)