Reputation: 151
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 !
Upvotes: 12
Views: 25038
Reputation: 941
For Windows user go to cmd as administrator and look up PID for the running port. For example my running port is 4200.
Then run this command on cmd
netstat -a -n -o
Find port with port number 4200 by lookingup in the list or you can right click on terminal and click find here enter 4200 in "find what" and click "find next": For example you found that port number 4200 is used by pid 17200 then type below command in cmd:
taskkill -f /pid 17200
Upvotes: 0
Reputation: 17068
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
Upvotes: 9
Reputation: 547
Please fire this one on git
cmd
sudo lsof -t -i tcp:4200 | xargs kill -9
Upvotes: 18
Reputation: 2382
Sometimes you need to kill process forcefully, use -9
for that
kill -9 $(lsof -t -i:4200)
Upvotes: 11
Reputation: 7713
Try seperatly executing your kill command. this how you do it.
run this command to get the proceess id who is using port 4320. in my example am showing you using mysql = 3360.
sudo ps -alh | grep "3360"
0 1000 20170 18854 20 0 14224 1092 pipe_w S+ pts/1 0:00 grep --color=auto 3360
then Execute kill command now:
sudo kill -s 18854
Done!
Upvotes: 1