Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng server - listen EACCES: permission denied 127.0.0.1:4200

Tags:

angular

I have no problem in do ng serve using 127.0.0.1:4200.

But today, when I do ng serve An unhandled exception occurred: listen EACCES: permission denied 127.0.0.1:4200

Is there a way to solve this problem permanently?

like image 593
Jared Ti Lian Eng Avatar asked Mar 02 '20 08:03

Jared Ti Lian Eng


4 Answers

I have solved this issue by simply going to Control Panel\Network and Internet\Network Connections and then I disabled all the Hyper-V Connections/Adapters and I kept the ones I use like the Wifi and Physical Ethernet Adapter.

No restart needed. Once done, try to run your Angular app on 4200 and it should work.

UPDATE

Alternative Solutions:

Sometimes just restarting Windows NAT driver can fix the issue:

  • open CMD/PowerShell and type net stop winnat and then net start winnat.

If that did not help then, try to stop the Windows NAT Driver and update the excludedportrange as follows :

  • type netsh int ipv4 add excludedportrange protocol=tcp startport=4200 numberofports=1 if you want to exclude port 4200 only if you want more just update numberofports
  • then start the Windows NAT Driver again and run your App.
like image 158
p90n33r Avatar answered Nov 09 '22 04:11

p90n33r


It sounds like your port is taken already.

You should kill the use in port 4200.

like image 19
Ben Ari Kutai Avatar answered Nov 09 '22 04:11

Ben Ari Kutai


  1. check might port already allocated for another application.

netstat -ano | findstr "4200"

  1. If you are using Docker might docker allocated this port (stop docker)

  2. Final solution restarting PC

like image 10
harshavardhan athaluri Avatar answered Nov 09 '22 06:11

harshavardhan athaluri


For me happens after Windows 10 Update to build 2009.

There is a network adapter which is blocking your port.

For @p90n33r was Hyper-V.

For me was Wifi adapter before I use ethernet port.

Try disable any adapters to test it.

No restart needed.

like image 5
Andre Mesquita Avatar answered Nov 09 '22 06:11

Andre Mesquita