Once a week I have to deal with a zombie process or try to start a process that’s already running on its designated port. In most cases I use macOS’s Activity Monitor to kill the process, which is time-consuming. What if we could just kill a process on a given port from the command line? Well, we can!
To terminate a process on a given port, install
kill-port and starting nuking those zombies via:
# yarn global add kill-port # Kill processes on multiple ports kill-port 6060 8000
If you want to programmatically kill a port that you want to ensure your app will run on, you can do that as well:
const kill = require('kill-port') kill(6060, 'tcp') .then(console.log) .catch(console.log)
I look forward to incorporating this library into my Node.js sites so that I can clear the way for a given port and avoid zombie processes.
5 Awesome New Mozilla Technologies You’ve Never Heard Of
My trip to Mozilla Summit 2013 was incredible. I’ve spent so much time focusing on my project that I had lost sight of all of the great work Mozillians were putting out. MozSummit provided the perfect reminder of how brilliant my colleagues are and how much …
One of the worst kept secrets about AJAX on the web is that the underlying API for it,
XMLHttpRequest, wasn’t really made for what we’ve been using it for. We’ve done well to create elegant APIs around XHR but we know we can do better. Our effort to …
Using Opacity to Show Focus with jQuery
Create a Twitter AJAX Button with MooTools, jQuery, or Dojo