How to kill a process running on a particular port
In this article, we will show you how to kill a process running on a particular port.
When you are working with Angular, React or Node/Express projects you may see an error like Port 4200 is already in use
or Error: Listen EADDRINUSE: Address already in use
.
Let’s try to kill the process running on the 4200
port.
For linux users:
1 | sudo kill $(sudo lsof -t -i:4200) |
You could also try this:
1 | sudo kill `sudo lsof -t -i:4200` |
For windows users:
Open the cmd as administrator. Type below command in cmd.
1 | netstat -a -n -o |
And then, find a port with port number 4200
. Let’s say we found that port number 4200
is used by pid 18932
. Run the following command.
1 | taskkill -f /pid 18932 |
I hope you find this article helpful.
Thank you for reading. Happy Coding..!! 🙂