After running npx expo start
and trying to open the app on my iphone,
I kept getting the following error "Unknown error: The network connection was lost."
This error caused me about 18.2345 headaches trying to figure out what was wrong.
I tried all of the basic troubleshooting steps mentioned below, but nothing worked. I also saw the suggestions about
npx expostart --tunnel
but opted not to go this route due to it being slower. I will explain what worked for
me, but first lets start with the basic troubleshooting steps.
Step 1: Make sure you have done/confirmed the following basic troubleshooting steps:
Make sure your phone and computer are on the same WiFi network
Clear the Expo Go app cache on your phone
npx expo start -c
Update Expo CLI to the latest version:
npm install -g expo-cli
These steps should resolve most QR code connection issues when working with Expo.
Step 2: If you are still having issues and currently have a headache, try the following:
Turn off your computer's firewall temporarily. I say temporarily because you'll need to turn it back on after you are done testing your app.
On Mac, go to Settings > Network > Firewall > Turn Off Firewall.
On Windows, go to Control Panel > System and Security > Windows Defender Firewall > Turn Off Windows Defender Firewall.