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 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.
Welcome to My New Office
My first professional web development was at a small print shop where I sat in a windowless cubical all day. I suffered that boxed in environment for almost five years before I was able to find a remote job where I worked from home. The first…
Table Cell and Position Absolute
If you follow me on Twitter, you saw me rage about trying to make
position: absolute
work within aTD
element ordisplay: table-cell
element. Chrome? Check. Internet Explorer? Check. Firefox? Ugh, FML. I tinkered in the console…and cussed. I did some researched…and I…CSS Sprites
The idea of CSS sprites is pretty genius. For those of you who don't know the idea of a sprite, a sprite is basically multiple graphics compiled into one image. The advantages of using sprites are: Fewer images for the browser to download, which means…