What is the difference between Tunnel vs. Lan vs. Local in Expo

Tunnel vs. Lan vs. Local

These are the options you see when you run ‘npm start’ or ‘expo start’, you see a bar code under the options for Tunnel, Lan, Local.

After selecting an option, then scanning the bar code (QR), how come some of them work sometimes vs. others? Often times if I switch to Tunnel, my project actually loads on my Expo app on my Android device. I always am connected to the same IP address on my phone and laptop.

local: this points to your own computer, 127.0.0.1 / localhost
lan: this is your network ip address
tunnel: this uses ngrok to make the server available anywhere on the internet if they have access to the url, so you could share the project with someone outside of your local network or access it from your phone if you are not on the same network or your network policies restrict access to other devices on the network

So the reason mine works most of the time on tunnel is maybe because I am not actually on the network ip address or localhost with my phone?

you might not be on the same network, or you are on a network that doesn’t let you connect to other devices on the network. you can also plug in your phone to your computer, use localhost, then press “a” in the expo-cli interactive prompt (or press open on android in the web browser) and it will run a tool called adb reverse which tells your android device to proxy requests to localhost to your computer via usb

1 Like

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