连接被拒绝:localhost:4200 favicon.ico 502 in angular 7 [英] Connection refused: localhost:4200 favicon.ico 502 in angular 7
问题描述
我通过
ng new project_name --style=scss
然后尝试通过
ng serve
但出现错误
删除并重新安装了node_modules
,但都是徒劳的.
removed and reinstalled the node_modules
but all in vain.
每次出现这个错误,请指导怎么办!!!
Every time getting this error, please guide what to do!!!
更新 1
为什么我无法在办公室电脑上的 localhost
(在 192.168.XX:4200 上运行)上运行 Angular
应用程序,但我可以在 localhost
上运行相同的项目code>localhost 在我家
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
更新 2
在主机文件中,我有这个.可以吗?
in hosts file, I have this. Is it OK?
127.0.0.1 本地主机
127.0.0.1 localhost
::1 本地主机
更新 3
我很确定,这只是系统配置问题,这就是为什么它阻止本地主机并允许 192.168.X.X 但不知道问题出在哪里.
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.
推荐答案
我使用 Opera
浏览器进行测试,它是我的默认浏览器并试图访问 localhost:4200
但是每次连接被拒绝
然后我在Chrome
上测试它,它运行顺利.
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.
我检查了两个浏览器的代理设置,但没有启用代理.最后,我在 Opera
中重置了设置和数据并解决了问题.
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.
仍然有问题!!!是什么阻碍了 localhost
...
Still, question is there!!! What was that hindering localhost
...
这篇关于连接被拒绝:localhost:4200 favicon.ico 502 in angular 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!