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`.
Checkout more articles on Node.js/ReactJS
- Git Clone Error: Repository not found
- Error handling in React
- Object doesn’t support property or method ‘find’ in IE
- How to disable the past and future dates in react-datetime
Let’s try to kill the process running on the `4200` port.
For linux users:
sudo kill $(sudo lsof -t -i:4200)
You could also try this:
sudo kill `sudo lsof -t -i:4200`
For windows users:
Open the cmd as administrator. Type below command in cmd.
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.
taskkill -f /pid 18932
I hope you find this article helpful.
Thank you for reading. Happy Coding..!! 🙂