create-react-native-app: development server is not started while scanning the QR code in Expo client application

Description

I recently started to learn React-Native and created a CRNA project. whenever I scan the QR code in Expo App , the application is not started on my android device though my mobile is connected to same wireless network as my PC (windows)

Expected Behavior

I tried to run “npm start” in command line.code compiled successfully and QR code generated in command line.Whenever I scan this code through Expo app it is not starting my apllication in android device.

Observed Behavior

I got following error

Something went wrong.
could not load exp://192.168.*.**:19000. Network response timed out.
error-log---
uncaught error:java.net.SocketTimeoutException: failed to connect to /192.168.*.**(port 19000) after 10000ms 

Environment

  • react-native-scripts:–react-native-scripts@0.0.31
  • react-native:-- react-native@0.44.3
  • expo:-- expo@17.0.0
  • node -v:v6.10.1
  • npm -v:3.10.10
  • yarn --version:N/A
  • watchman version:
  1. Operating system:windows-10
  2. Phone/emulator/simulator & version:android v 6.0

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 30 (6 by maintainers)

Most upvoted comments

@FredyC I got an alternative for same problem please download “Expo XDE” (desktop application) it will definately solve your problem. following steps you need to follow 1-download Expo XDE for your appropriate OS(ie. windows or mac) from https://expo.io/ 2-open Expo XDE and you will find your CRNA project , click on specific project you want to run , 3- click on the gear icon in address bar and select host as a Lan , here you will find your “ipAddress:host” paste this address to your expo mobile App in explore section and if everything is right then you will get your application running on your mobile … hope it will help you

Ok, I think I’ve found the culprit. I have a Docker installed which has its own network adapter. For some reason the Expo picks this virtual network over the real one. Using env variable as @brentvatne suggested works, but it’s totally cumbersome solution.

I am wondering if this could be somehow configurable per project.

Today i got the same error (Network response timed out.) also couldn’t access packager’s address from iphone’s browser. The problem was packager gets the first network adapter’s local address (for me it was virtual-box adapter) 192.168.56.1 but my wireless network’s local address was 192.168.1.28 So instead of scanning url, i manually entered exp://192.168.1.28 to expo ios-app and it worked.

Yea, in the end, I’ve solved the problem by changing priorities of my network adapters so the one I want is a first one. Works like magic 😃

I ran into this problem today, and then this github issue. It might be helpful to realize there are two facets to the multiple IP address situation.

The first facet is what IP address the server is listening on. Via netstat -an, you can see that the server is listing on all of the computer’s IP addresses: Proto Local Address Foreign Address State TCP [::]:19000 [::]:0 LISTENING TCP [::]:19001 [::]:0 LISTENING

So that facet seems solved already.

The second facet is which IP address to tell the user to type into Expo (or to transmit via the QR code). This is a more difficult problem, because you don’t know for sure how the user has configured their network.

Idea 1: If you’re on Windows and can access its details for each network adapter, you could guess that the user’s phone is probably on a “Wireless LAN adapter” rather than an “Ethernet adapter”.

Idea 2: Since QR codes have the capacity for 406 bytes, you could transmit an array of IP addresses, and the app can try each of them until it finds one that works.

Idea 3: Use a different protocol that does some sort of subnet broadcast.

Anyway, in my opinion, this should be solved on the Expo side to allow to pick which adapter to use. It’s not always feasible to switch adapters priorities, in particular for people moving between e.g. wifi and wired connection.

It was an issue for me. Having latest versions/updates of everything. Win10, vmware, vbox, create-react-native-app.

Tried disabling and enabling the firewall.

Though it worked from Expo XDE, I just felt like it should work on CLI.

So the issue was (as described earlier by @ahmetkakici) that yarn start was using vmware network adapter.

I went to the settings of my wi-fi adapter and changed metrics on TCPIP4 to 2 https://www.ghacks.net/2016/12/02/change-network-adapter-priorities-in-windows-10/

Now CRNA with yarn start points to the proper IP and everything is working from CLI