How to open the localhost in riplit
I'm running an Angular/Ionic 5 Web App in Riplit.
When running the app, it complies and tells me that the ANgular Live Server is running on Localhost: 4200.
Date: 2021-05-03T20:59:45.892Z - Hash: 6d16985704fcaf4e31bf - Time: 50685ms
Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/
ℹ ｢wdm｣: Compiled successfully.
When I click on the link, it tries to open localhost:4200 in the local machine, but nothing loads.
I'm thinking it's because it's actually running on the VM.
How do I access the localhost in the VM?
Thanks in advance. Cheers!
Angular is probably trying to run on
127.0.0.5, which is a local IP that cannot be accessed outside of the machine/WiFi. See if you can configure it to run on
0.0.0.0, which allows access from the outside world.
ng serve --host 0.0.0.0. I just got this from the Angular docs, so that may not work. Tell me if it doesn't, so we can fix it!
If you are on Repl.it, then a box with the website should pop up. (The format is <replname>.<user>.repl.co.) If you are running this through your machine, then try executing
ng serve --host 127.0.0.5 --port 8000. Then you can open up your browser (Chrome, Safari, etc.) and go to https://127.0.0.5:8000.
Opening to 0.0.0.0 on your computer can be dangerous, as it allows people from outside your network to access your device. Replit relies on this, but you shouldn't.