# Quick way to fix the Port is Already in Use Error

Have you ever struggled with the `the port is already in use` error while starting the application?

A lot of times when we are using multiple applications or forget to stop the previous process, we get the `the port is already in use` error.

Then we try to find the process using that port and then kill it or maybe restart the machine.

There is an easier way to do it. Just execute the following command in the terminal:

```js
npx kill-port port_number
```

and the process using that port will be killed.

For example,

```js
npx kill-port 3000
```

will kill the process using port 3000.

To kill multiple ports pass the ports separated by space

```js
npx kill-port 3000 5000 7000
```

`kill-port` in an npm package which helps in killing any specified port or multiple ports at once.

If you want, you can install the `kill-port` npm package on your machine by running the following command:

```js
npm install -g kill-port
```

> Mac/Linux users may need to add `sudo` in front of it like this: `sudo npm install -g kill-port`.

Once installed, you can just execute the `kill-port 3000` to kill the process using port 3000.

### Thanks for reading

Starting with ES6, there are many useful additions to JavaScript like

* ES6 Destructuring
* Import and Export Syntax
* Arrow functions
* Promises
* Async/await
* Optional chaining operator
and a lot more.

**You can learn everything about all the ES6+ features in detail in my [Mastering Modern JavaScript](https://modernjavascript.yogeshchavan.dev/) book.**

> Check out free preview contents of the book [here](https://www.freecodecamp.org/news/learn-modern-javascript/).

Also, you can check out my **free** [Introduction to React Router](https://yogeshchavan1.podia.com/react-router-introduction) course to learn React Router from scratch.

Want to stay up to date with regular content regarding JavaScript, React, Node.js? [Follow me on LinkedIn](https://www.linkedin.com/in/yogesh-chavan97/).

[<img src="https://gist.github.com/myogeshchavan97/98ae4f4ead57fde8d47fcf7641220b72/raw/c3e4265df4396d639a7938a83bffd570130483b1/banner.jpg">](https://bit.ly/3w0DGum)

[<img src="https://cdn.buymeacoffee.com/buttons/default-yellow.png" >](https://www.buymeacoffee.com/myogeshchavan97)
