Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Port 4200 is already in use". Killing all the processes associated with 4200 did not work.

I'm trying to get angular running on my Mac OS X 10.11.3 El Capitan.

I installed nodeJS and npm. Through npm I installed angular-cli.

I created a new app via the command sudo ng new first-app

I navigated into the app folder and ran sudo ng serve.

It threw the following error :

Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
Port 4200 is already in use.

With reference from another answer, I tried the following :

sudo kill $(sudo lsof -t -i:4200)

It did not help.

Actually, I have re-installed nodejs, npm, angular-cli. When I had installed it before there was some build error as there was some bower issue. Not sure what. When I accessed localhost:4200 that time, the page showed up but with the error log on it. Now the page doesn't even load. The loading symbol just keeps circling near the favicon. I don't know if this could be a lead.

Thanks. I need to get angular running pronto. Lots to learn !

like image 750
Shoaib Ali C H Avatar asked Sep 06 '16 06:09

Shoaib Ali C H


3 Answers

This help me. Kill the process on port 4200 on mac terminal

npx kill-port 4200

Then use

ng serve

Reference - Find (and kill) process locking port 3000 on Mac

like image 70
San Jaisy Avatar answered Nov 15 '22 18:11

San Jaisy


Please fire this one on git cmd

sudo lsof -t -i tcp:4200 | xargs kill -9
like image 31
Hasmukh Ahir Avatar answered Nov 15 '22 20:11

Hasmukh Ahir


Sometimes you need to kill process forcefully, use -9 for that

kill -9 $(lsof -t -i:4200)

like image 31
Freddy Avatar answered Nov 15 '22 20:11

Freddy