Search code examples
angularangular7connection-refused

Connection refused: localhost:4200 favicon.ico 502 in angular 7


I have create an angular project via

ng new project_name --style=scss

and then try to run via

ng serve

but getting error

enter image description here

enter image description here

removed and reinstalled the node_modules but all in vain.

Every time getting this error, please guide what to do!!!

UPDATE 1

Why I am not able to run Angular application on localhost (running on 192.168.X.X:4200) in my office pc but the same project I can run on localhost at my home

UPDATE 2

in hosts file, I have this. Is it OK?

127.0.0.1 localhost

::1 localhost

Update 3

I am quite sure, it is only the system config issue that's why it is blocking localhost and allowing 192.168.X.X but don't know where the problem lies.


Solution

  • I was using Opera browser for testing and it was my default browser and trying to access localhost:4200 but every time connection refused then I test this on Chrome, it ran smoothly.

    I checked proxy setting for both the browsers and there was no proxy enabled. Finally I reset settings and data in Opera and problem resolved.

    Still, question is there!!! What was that hindering localhost ...