Hi all, after running npm start and scanning the QR code on the Expo app, I run into the following issue:
"Error while loading: Could not connect to the server.." (code - 1004)
I'm on Node version 7.7.2. The error persists even when I enter the address in the app's search bar. Thanks!
Hi! Thanks for the report. Are your phone and computer on the same local network?
@dikaiosune Yup! I also messaged the help channel on the expo-developer Slack and I was told that this issue was due to the particular Wifi router that I was using
Interesting. You can try working around this by using your phone's WiFi hotspot if your data plan supports it. That is the easiest way to resolve networking issues currently.
I had a very similar issue, although not exactly the same. For me, scanning the QR code resulted in connection timeout. Using phone's hotspot did not help, USB tethering did not work either. Explicitly allowing ports in windows firewall had no effect.
After some fiddling, I was able to fix the issue using combination of adb reverse tcp:8081 tcp:8081 (you can find adb in node_modules/xdl, no need to install adroid toolchain) and the following lines in .expo/settings.json (only hostType should be crucial):
{
"hostType": "localhost",
"lanType": "ip",
"dev": true,
"strict": false,
"minify": false,
"urlType": "exp"
}
Leaving it here because I wasn't able to find this in docs here or on expo website.
@egor-laufer I don't think those commands would have had any effect -- CRNA runs the packager on port 19001, not 8081, and when xdl is in "offline" mode (which CRNA enables) the lanType is inferred to be ip anyways. No other lanType setting will have an effect in offline mode, IIRC.
Adding a docs label because network troubleshooting is likely to come up again, should be added to user guide.
I'm having a similar issue (same error code). I'm working out of a coworking space (a new one). I think they had a company come in and do a full setup (in terms of wifi, printer, etc) and I'm wondering if they used some security settings that are causing issues using expo. I had a similar wifi-related issue the other day trying to download a zip file. A lot of the other people here aren't developers, so it may not be something others run into.
Has anyone come across a similar situation?
I also see this in expo console when trying to run via TUNNEL:
Switched to a LAN URL because the tunnel appears to be down. Only devices in the same network can access the app. You can restart the project to try reconnecting.
localhost and LAN run, but I get the "There was a problem loading the experience" screen.
UPDATE:
It definitely had something to do with the wifi settings at the coworking space, as I'm back home on different wifi and it's working with no problems. If anyone has a guess as to what may be the issue with the wifi setting, please let me know! I don't know much about office/enterprise wifi setups, but I'm guessing this is relatively common.
Agree with @acomito. I have the same issue on my mac. I change to my iPhone hotspot 'npm run ios' and it works, so I change it back to my wifi and run it again and somehow it fixed and working again.
Most helpful comment
I had a very similar issue, although not exactly the same. For me, scanning the QR code resulted in connection timeout. Using phone's hotspot did not help, USB tethering did not work either. Explicitly allowing ports in windows firewall had no effect.
After some fiddling, I was able to fix the issue using combination of
adb reverse tcp:8081 tcp:8081(you can find adb innode_modules/xdl, no need to install adroid toolchain) and the following lines in.expo/settings.json(only hostType should be crucial):Leaving it here because I wasn't able to find this in docs here or on expo website.