How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (2024)

How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (1)

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)

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)

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)

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)

That’s it 🙂

How to avoid ‘Port 4200 is already in use’ error with Angular-CLI? | Nexus Innovations (2024)
Top Articles
Latest Posts
Article information

Author: Rueben Jacobs

Last Updated:

Views: 6486

Rating: 4.7 / 5 (57 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Rueben Jacobs

Birthday: 1999-03-14

Address: 951 Caterina Walk, Schambergerside, CA 67667-0896

Phone: +6881806848632

Job: Internal Education Planner

Hobby: Candle making, Cabaret, Poi, Gambling, Rock climbing, Wood carving, Computer programming

Introduction: My name is Rueben Jacobs, I am a cooperative, beautiful, kind, comfortable, glamorous, open, magnificent person who loves writing and wants to share my knowledge and understanding with you.