拒绝连接:Angular 7中的localhost:4200 favicon.ico 502 [英] Connection refused: localhost:4200 favicon.ico 502 in angular 7
问题描述
我已经通过创建一个角度项目
I have create an angular project via
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
为什么我不能在Office PC的 localhost
(运行在192.168.XX:4200上)上运行 Angular
应用程序,但是可以在<在我家里的代码>本地主机
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
在hosts文件中,我有这个.可以吗?
in hosts file, I have this. Is it OK?
127.0.0.1本地主机
127.0.0.1 localhost
:: 1本地主机
更新3
我很确定,这只是系统配置问题,因此它阻止了localhost并允许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
...
这篇关于拒绝连接:Angular 7中的localhost:4200 favicon.ico 502的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!