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.
To simple kill the process that is running on a specific port, run this command:
npx kill-port 4200
4200 is the port that needs to be stopped.
And the result is satisfying.
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