简体   繁体   中英

Unable to connect to expo xde using expo client on local network

I need help about expo xde. After creating project, when I scan QR Code it is giving me following error:

there was a problem loading the experience. It looks like you may be using a LAN url. 
Make sure your device is on same network as server or try using a tunnel

exp://*.*.*.*:19000
Error Code: NETWORK_ERROR
Code: -1004

My mobile device is on same network as my laptop.I am using:

OS: window 10
Node Version: 8.9.4
NPM Version: 4.6.1

It works on tunnel connection but it is bit slow.

This error means the mobile device can not connect to the development server running on your laptop.

Possible reasons for this include:

  • Your mobile device and laptop are not connected to the same LAN (local area network).
  • The network/router doesn't allow devices to connect to each other.
  • Your laptop has a firewall that is blocking connections to the development server port (in this case port 19000).
  • Your laptop has multiple network interfaces and the LAN URL points to a different one than that the mobile device can connect to.

To fix this you could:

  • Use the tunnel URL that is slower, but works even if the device can't connect through LAN.
  • Change firewall settings / use a different network.
  • Connect your laptop to your mobile hotspot.
  • If you have multiple network interfaces and XDE shows the IP address of a wrong one, you can use Expo CLI and set the correct IP with the EXPO_PACKAGER_HOSTNAME environment variable. (On Windows) you can alternatively adjust the priority of your network adapters .
  • (Android only) Install Android developer tools, plug your Android device to your laptop via USB and ensure USB debugging is enabled. Expo developer tools automatically run adb reverse , which makes the device able to connect via USB using the localhost URL.

For me it only worked to disable all other network adapters.

Setting the REACT_NATIVE_PACKAGER_HOSTNAME environment variable or setting the priotities of the adapters did not work for me.

And of course I was on the private network and had disabled the firewall for it until I configured it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM