mph85
mph85

Reputation: 1356

React Native App with Expo - QR code not loading

I'm following this tutorial:

https://blog.expo.io/building-a-react-native-app-using-expo-and-typescript-part-1-a81b6970bb82

yarn global add create-react-native-app

create-react-native-app my-app-name

cd my-app-name

yarn start

I am on the same network as my phone (Android). No VPN. I am in the root folder of my app. It says Loading dependency graph, done. so I know it's running.

Firewall is also off for this as well and this is not a timeout error.

When I scan the QR code:

Something went wrong. Could not load exp://10.0.0.21:19000.

What could be my issue?

EDIT

New error: Uncaught Error: java.net.ConnectException: Failed to connect to /10.0.0.21.19000

Upvotes: 14

Views: 37309

Answers (9)

javascriptes
javascriptes

Reputation: 63

This is what worked for me. I just did what @Nupur Sharma said, but since the expo cli seems to only now works remotely with npx, I ran the command npx expo start --tunnel. This prompted me to install expo/ngrok which is a server for tunnels and so I accepted. After running the app again I was able to scan the qr code and load the app on my Android device.

Upvotes: 1

Charlie
Charlie

Reputation: 341

In case if someone is still looking for a solution, just turn off your Firewall, temporarily. In my case, I'm on Windows 11 and McAfee blocks the connections.

Upvotes: 0

I had this problem after and expo update. Instead of running

npm/yarn start 

(executes expo start --dev-client)

Try

npm run run

(executes expo start)

Upvotes: 2

Ankit Pundir
Ankit Pundir

Reputation: 21

Try the Enter URL manually option

  • First make sure you are on the same wifi ( computer || laptop and mobile device)
  • Second open cmd and run command ipconfig their you will get IPv4 Address copy it
  • Go to your expo go app tap on Enter URL manually
  • Enter exp://your_IPv4_Address:19000 ( Example -- exp://192.168.1.38:19000 )
  • Connect now -- It should work

Upvotes: 2

gopher166
gopher166

Reputation: 137

On node v12.18. In the package.json downgrade expo and react-native connector. 38 works instead of 40.

"expo": "~38.0.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.0.tar.gz",

Then remove node_modules and reinstall them

rm -rf node_modules
npm install

then run again :

npm start 

QR should work this time

Upvotes: 0

Abhilash Ramteke
Abhilash Ramteke

Reputation: 436

Just delete the node_modules folder from your application and then run npm install to get the dependencies.

Now run expo start or npm start, the QR code will load now.

Upvotes: 0

Nathan Barel
Nathan Barel

Reputation: 388

In my case, I used tunnel and there was a problem with the sdk version - I have 39.0.0 and I should use only 36, 37 or 38 - that is the message that i have got from expo, so all I did is to get into the app.json file, and add the following line in expo (or just change it if it already exist):

"sdkVersion": "38.0.0"

and it should look like:

    "expo": {
            "name": "DoneWithIt",
            "slug": "DoneWithIt",
            "sdkVersion": "38.0.0",
            "version": "1.0.0",

    ....
    ....
    }

In the package.json file in dependencies, change the version to 38.0.0 in "expo" and "react-native" :

"dependencies": {
    "expo": "~38.0.0",
    "expo-status-bar": "~1.0.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk- 
     38.0.0.tar.gz",
    "react-native-web": "~0.13.12"
  }

then run:

cd yourAppName 
npm start 

and it will be loaded on your phone. you can watch it from here: https://www.youtube.com/watch?v=eS8VULijAZ4

In this video he uses 32.0.0 so be aware to the updated version (in my case 38.0.0 was good for 09/2020)

Upvotes: 0

Nupur Sharma
Nupur Sharma

Reputation: 1214

run the command

expo start --tunnel 

Upvotes: 5

Rishav Kumar
Rishav Kumar

Reputation: 5450

Try opening the debugger in chrome and then select tunnel if your device and the development pc are not connected to the same server.

Upvotes: 9

Related Questions