Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
406 views
in Technique[技术] by (71.8m points)

Unable to access the angular app running locally on localhost from a different machine

I'm trying to access my angular 10 app from other machine. I have tried the below options but nothing worked.

ng serve --host 0.0.0.0 --disableHostCheck true
ng serve --open --host 0.0.0.0 --disable-host-check
ng serve --host 192.168.x.x

I have looked at similar questions and tried all the solutions but nothing worked for me. I tried enabling Node.js to communicate through Windows Defender Firewall.

enter image description here

I have created a brand new angular 10 app and tried running it locally and accessing it from a different machine but that didn't work as well. I'm suspecting there is something wrong with my windows proxy settings and I have tried all of this in my office network. Please help!

question from:https://stackoverflow.com/questions/65893678/unable-to-access-the-angular-app-running-locally-on-localhost-from-a-different-m

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think you need to connect the two computers on the same network, and then identify the ip address of your machine on which the angular application is to start and when starting the application use the following command

ng serve --host your-local-ip-address

and to access it from the other computer your-local-ip-address: port-number

exmple: 192.168.1.114:4200


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...