Clue Mediator

How to kill a process running on a particular port

📅December 3, 2021

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" title="Git Clone Error: Repository not found">Git Clone Error: Repository not found
  • Error handling in React
  • ie" title="Object doesn’t support property or method ‘find’ in IE">Object doesn’t support property or method ‘find’ in IE
  • datetime" title="How to disable the past and future dates in react-datetime">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..!! 🙂