Why does Expo URL change when I re-run exp start

PROBLEM

git clone https://github.com/thinkocapo/rag-tag-react-native.git
npm install
exp start

The first few times I run exp start it gives a URL like:
[13:23:13] Your URL is: exp://dz-dca.thinkocapo.rag-tag-react-native.exp.direct:80 and scanning the QR Code works, app loads fine.
But upon a re-start the URL changes to:
Your URL is: exp://192.168.1.73:19000
and when I scan the QR it errors on my mobile device. I did not make any changes to the source code, all I did was ctrl+c to kill the app and then I re-started the app.
It also says in my expo CLI log:

[13:15:29] Switched to a LAN URL because the tunnel appears to be down. Only devices in the same network can access the app. Restart with `exp start --tunnel` to try reconnecting.

FAILED SOLUTION

re-start with exp start --tunnel it still shows a URL like exp://192.168.1.73:19000, QR scan still fails.

SOLUTION That is not sustainable for development:

Delete the entire project directory, and re-do git clone... npm install expo start, it then works on first try: [13:23:13] Your URL is: exp://dz-dca.thinkocapo.rag-tag-react-native.exp.direct:80
and sure enought I do ctrl+c to kill the app, I restart it and its Your URL is: exp://192.168.88.12:19000 again. Weird!

Wifi Note

I’m at a co-working space. I’m not using a VPN. Wifi connection is fine, loading pages no issue, full strength.

Ok so my mobile was on WifiFloor1 and my laptop was on WifiFloor2

I put them both to WifiFloor1 and all seems to be working now. For a brief second during the build, the build paused on 68% and it said:

[13:52:11] We noticed your tunnel is having issues. This may be due to intermittent problems with our tunnel provider. If you have trouble connecting to your app, try to Restart the project, or switch Host to LAN.

but then it recovered. Do wifi’s sometimes timeout? Very quickly so that you don’t notice if you’re browsing the web but it will totally mess up your react-native & Expo development experience?

Question

How to make it so it doesn’t care which WIFI you’re on? Can someone give an explanation as to how LAN works, what’s it about? I think that’s the solution

Previously I had tried all of these and none of them worked, back when my devices were on separate Wifi networks:
exp start -m tunnel
exp start -m lan
exp start --help for more options

https://docs.expo.io/versions/latest/workflow/how-expo-works#serving-an-expo-project-for-local-development has some explanation, and I just wrote something up here:

Hope that helps.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.