Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 418
Saad Mehmood Avatar asked Mar 07 '18 12:03

Saad Mehmood


1 Answers

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.
like image 82
fson Avatar answered Sep 21 '22 15:09

fson