问题
I have create an angular project via
ng new project_name --style=scss
and then try to run via
ng serve
but getting error
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.
回答1:
There is no Angular CLI command such as npm start, Did you mean that?
ng serve
Please check this out, https://angular.io/cli/serve
回答2:
Put your favicon.ico file in assets folder and change the path in the index.html
回答3:
Just put your favicon.ico
file to your project root directory and update your favicon
file inject code with the below code in the head
of your index.html
file. Thanks
<link rel="icon" href="favicon.ico" type="image/x-icon">
回答4:
You can use the following method to solve the same :
Check your LAN proxy settings.
In chrome Settings -> Advanced -> Open Proxy Settings -> LAN Settings -> make sure you unchecked "use proxy server for your LAN" or mark "bypass proxy server for local address" if you are using proxy
Also if the above settings didn't solve your problem probably the port 4200
is already used in the system try running app on a different port ng serve --port 4401
Also make sure you clear browser cache to see the result
回答5:
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 data in Opera
and problem resolved.
Still, question is there!!! What was that hindering localhost
...
来源:https://stackoverflow.com/questions/54977872/connection-refused-localhost4200-favicon-ico-502-in-angular-7