Terminate Process on a Port from Command Line
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.
How is it possible that JavaScript-based animation has secretly always been as fast — or faster — than CSS transitions? And, how is it possible that Adobe and Google consistently release media-rich mobile sites that rival the performance of native apps?
This article serves as a point-by-point...
With CSS border-radius, I showed you how CSS can bridge the gap between design and development by adding rounded corners to elements. CSS gradients are another step in that direction. Now that CSS gradients are supported in Internet Explorer 8+, Firefox, Safari, and Chrome...
One of the quickest and easiest website performance optimizations is decreasing image loading. That means a variety of things, including minifying images with tools like ImageOptim and TinyPNG, using data URIs and sprites, and lazy loading images. It's a bit jarring when you're lazy loading images and they just...