All Articles

How to kill the process currently using a given port on Windows

Sometimes when I tried running my Angular application and saw this message.

An unhandled exception occurred: Port 4200 is already in use. Use ‘—port’ to specify a different port.

How to kill the process running on given port on Windows

To simple kill the process that is running on a specific port, run this command:

npx kill-port 4200

Where 4200 is the port that needs to be stopped.

And the result is satisfying.

How to kill the process running on given port on Windows

You must have [email protected]^ version to run npx, which means as the minimum of npm running on your machine must be 5.2.0 or greater.

You can also read more about kill-port here: https://www.npmjs.com/package/kill-port

Published 12 Sep 2020

Recent Posts

Top-level await

How to use top-level await in ES Modules without all of the crazy hack

Space Invaders game built with Phaser 3 and TypeScript

There were quite a lot of changes between Phaser 2 and 3 but I like version 3 better. It made the code much more readable and structure


Follow @tuantrungvo on Twitter for more!