12

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 !

Shoaib Ali C H
  • 151
  • 1
  • 1
  • 6

7 Answers7

18

Please fire this one on git cmd

sudo lsof -t -i tcp:4200 | xargs kill -9
H D Ahir
  • 547
  • 3
  • 20
11

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

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

Freddy
  • 2,216
  • 3
  • 31
  • 34
9

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

San Jaisy
  • 15,327
  • 34
  • 171
  • 290
1

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!

Develop4Life
  • 7,581
  • 8
  • 58
  • 76
  • 501 73083 69535 4006 0 31 0 2445080 360 - T 0 ttys000 0:00.00 grep :4200 501 74143 69535 4006 0 31 0 2453272 804 - S+ 0 ttys000 0:00.00 grep 4200 I got this as the result. What should I do now ? Which is the signal ? All the values are coming as unknown signals. – Shoaib Ali C H Sep 06 '16 at 08:21
  • sudo kill -s 69535 or sudo kill -s 4006 – Develop4Life Sep 06 '16 at 08:23
1

You can use

lsof -t -i tcp:4200 | xargs kill -9

it worked for me

ron33
  • 31
  • 4
0

Try this:

fuser -n tcp -k 4200 -f
venerik
  • 5,766
  • 2
  • 33
  • 43
Alen
  • 1
  • 1
0

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
Dharman
  • 30,962
  • 25
  • 85
  • 135
Rashi Goyal
  • 933
  • 9
  • 15