Have you ever struggled with the the port is already in use
error while starting any 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:
npx kill-port port_number
and the process using that port will be killed.
For example,
npx kill-port 3000
will kill the process using port 3000.
To kill multiple ports, pass the ports separated by space:
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:
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!
Check out my recently published Mastering Redux course.
In this course, you will build 3 apps along with food ordering app and you'll learn:
- Basic and advanced Redux
- How to manage the complex state of array and objects
- How to use multiple reducers to manage complex redux state
- How to debug Redux application
- How to use Redux in React using react-redux library to make your app reactive.
- How to use redux-thunk library to handle async API calls and much more
and then finally we'll build a complete food ordering app from scratch with stripe integration for accepting payments and deploy it to the production.
Want to stay up to date with regular content regarding JavaScript, React, Node.js? Follow me on LinkedIn.
Comments (0)