port 4200 is already in use

“Port 4200 is already in use” while running ng serve Angular CLI command

When you tried to run an Angular Project using “ng serve” command and see error like “Port 4200 is already in use. Use ‘–port’ to specify a different port“.


First you can investigate whether the port 4200 is already in use. To check that try running the following netstat command in Windows

> netstat -a -n -o | findstr :4200
  TCP              LISTENING       18028
  TCP        ESTABLISHED     18028
  TCP         ESTABLISHED     4344

The PID “4344” is from “ng serve”. If you would like to kill this process, then run the following command.

> taskkill /PID 4344 /F
SUCCESS: The process with PID 4344 has been terminated.

If you don’t like to terminate the process and wanted to specify a different port, then you can run the following command

> ng serve --port 8001

This means that you already have another service running on port 4200 and you can either terminate the process or service which is using that port or use the flag “–port” while runnning “ng serve”

The above command would change the URL to something like


Hope this resolves this issue 🙂

Further Learning


Leave a Reply

Notify of