![How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (1) How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (1)](https://i0.wp.com/nexusinno.com/wp-content/uploads/avoid_port_4200_thumbnail-1024x538-1.jpg)
If you get this error:‘Port 4200 is already in use. Use ‘–port’ to specify a different port’, you might have left your Angular development environment without closing the node.js webserver’s port.
Here’s how you can close it without having to reboot your computer or change your application’s port.
Step 1: Find the connection’s PID
netstat -ano | findstr :yourPortNumber
Example with its output:
![How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (2) How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (2)](https://i0.wp.com/nexusinno.com/wp-content/uploads/findstr1.png)
Then locate the PID (surrounded in red)
Step 2: Kill the process using it’s PID
tskill yourPID
Example:
![How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (3) How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (3)](https://i0.wp.com/nexusinno.com/wp-content/uploads/tskill1.png)
Step 3: Restart your server
You should be able to run it (usingng serve)
![How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (4) How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (4)](https://i0.wp.com/nexusinno.com/wp-content/uploads/ngserve.png)
Step 4: Stop your server properly
Don’t forget now to close properly your server by usingCtrl + Cand typingY:
![How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (5) How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (5)](https://i0.wp.com/nexusinno.com/wp-content/uploads/terminate-batch.png)
That’s it 🙂