N Sharma
N Sharma

Reputation: 34497

Could not load exp:// Something went wrong

I have created a project using Expo XDE. I checked this Can't load expo app: Something went wrong but I have already enabled "Draw over other apps". It works https://expo.io/@ajaysaini/first-proj when I scan this QR code but it doesn't when I run it on android device from XDE.

main.js

import Expo from 'expo';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>Updating!</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Expo.registerRootComponent(App);

When I am running it on device it shows below error on android device. I tried restart in XDE multiple times but it didn't help me.

enter image description here

Dependency graph loaded.
11:19:21 AM
Starting React Native packager...
11:19:24 AM
Scanning 528 folders for symlinks in D:\Expo\first-proj\first-proj\node_modules (18ms)
11:19:24 AM
Loading dependency graph.
11:19:24 AM
Running packager on port 19001.
11:19:25 AM
11:19:33 AM
Project opened! You can now use the "Share" or "Device" buttons to view your project.
11:19:44 AM
Opening on Android device
11:19:54 AM
Dependency graph loaded.
11:21:41 AM
Opening on Android device
11:23:31 AM
Opening on Android device

Error:

There was an unhandled error: Could not load exp://
Stack Trace:

Can anyone help me what is going wrong ?

Upvotes: 20

Views: 63897

Answers (21)

Jheysson Urbano
Jheysson Urbano

Reputation: 107

I had this issue because I run the backend in the same port

Upvotes: 1

Sudhir
Sudhir

Reputation: 805

I used tunnel instead of lan or local and it worked and started building the application after I scanned the code. enter image description here

Upvotes: 0

Elham Nikbakht
Elham Nikbakht

Reputation: 101

check if you run VPN on your pc or your mobile turn it off and then restart. For me this solve my problem.

Upvotes: 0

tbs
tbs

Reputation: 480

Changing my home network from 'public' to 'private' worked for me. Open you network connections -> right click on your home network connection -> properties -> Change "Network Profile" from 'public' to 'private'

Upvotes: 0

Shubham-luv2code
Shubham-luv2code

Reputation: 21

I tried suggestions given here but are not suitable for my issue. This worked for me. Go to your browser where localhost:19002 is running and change the connection to Tunnel. Scan the new QR code generated from your mobile. Hope this helps!

Upvotes: 2

Nathan Simpson
Nathan Simpson

Reputation: 27

I recommend deleting the .expo folder before running Yarn :)

Upvotes: 1

Arifur Rahman
Arifur Rahman

Reputation: 111

On the Start menu, click Run, type WF.msc, and then click OK.

In the Windows Firewall with Advanced Security, in the left pane, right-click Inbound Rules, and then click New Rule in the action pane.

In the Rule Type dialog box, select Port, and then click Next.

In the Protocol and Ports dialog box, select TCP. Select All local ports, Click Next.

In the Action dialog box, select Allow the connection, and then click Next.

In the Profile dialog box, select any profiles that describe the computer connection environment when you want to connect to the Database Engine, and then click Next.

In the Name dialog box, type a name and description for this rule, and then click Finish.

Upvotes: 1

eden
eden

Reputation: 6103

You better open XDE Client and enable development mode. Then, click on the gray cog to make Host > LAN (Local area network - which means sharing packages over WiFi with a real device).

Localhost option may work as well but according to Expo Debugging docs:

If you are using LAN, make sure your device is on the same wifi network as your development machine. This may not work on some public networks. localhost will not work for iOS unless you are in the simulator, and it only works on Android if your device is connected to your machine via USB.

Also, here is a visual informative answer that I wrote a few months ago that may also help: How do I run an app on a real iOS device using Expo?

Upvotes: 21

Clint Fidel
Clint Fidel

Reputation: 41

Ensure that your laptop and android device is connected to the same network and that should fix the issue, as it just did for me.

Upvotes: 0

Dorklord
Dorklord

Reputation: 454

In case you guys use firewall, make sure ports 19000 and 19001 are whitelisted.

Upvotes: 1

khalid khuz nain
khalid khuz nain

Reputation: 91

In my case it was VPN - I have connected my mobile with VPN after disconnect it loaded successfully !

Upvotes: 0

Codedreamer
Codedreamer

Reputation: 1702

I guess a lot of people must have done all the above and still have Something went wrong error

The docs might have specify when building locally and your device is connected to your machine you should click on the Local section on web debug page which shows the QRcode image.

enter image description here

Then after clicking on Local, try to scan the QRcode once again your error should disappear and shows a loading bundling javascripts assets.

Upvotes: 4

Faisal Arshed
Faisal Arshed

Reputation: 539

I encountered the same problem and none of the solutions worked for me. The problem here is that Expo shows the wrong IP address which your phone can't connect to.

This is how I worked around it. I'm going to assume that you're on windows and using LAN to run the app on your device.

  1. Open cmd, type ipconfig and find out your local IP. It should be listed as IPv4 Address under the Wireless LAN Adapter section. It will look something like 192.168.xx.x
  2. Now open any text editor in your phone and type exp://192.168.xx.x:19000. Copy this text to your clipboard.
  3. Open Expo app. You will now see the Open from Clipboard option on the top. Press it and your app should load.

Now anytime you want to load an app, you can copy the same address and open it in Expo.

There's another simpler workaround I found. Run the command set REACT_NATIVE_PACKAGER_HOSTNAME=192.168.xx.x before expo start. This will set the correct IP in Expo Dev Tools.

Hope this helps.

Upvotes: 14

zclee
zclee

Reputation: 23

I fixed my issue by update npm and node ..

Upvotes: -1

Justin Wilson
Justin Wilson

Reputation: 11

Assumptions: Installed Expo (https://expo.io) on Computer via NPM/Yarn and installed Expo on Android/iPhone. Also, Phone is on the same wifi network as Computer.

My Computer was connected via WiFI, and this was the problem for me. Windows: Commandline: $ ipconfig Find Wifi IP Address of your Computer. Mine was Ip v4 : 192.168.1.xxx Type in the web browser on the Phones web Browser URL : exp://192.168.1.xxx:19000 Then should see some text, which means the phone is connecting via the Network (good sign) Then open expo on Phone, and should see link via Clipboard. Click on Link via Clipboard which is inside the Expo program on the phone. Then it should load the App on your phone. This worked for me. P.s Follow instructions for giving Expo permission etc when it works for the first time.

Upvotes: 1

Ali A. Aziz
Ali A. Aziz

Reputation: 506

Sometimes the problem is due to using a wrong network adapter priority.

open the terminal and run

ipconfig

if your main LAN adapter is not listed as the first adapter, then changing the adapter priority may solve the problem. Just follow the steps:

  1. Goto Control Panel > Network and Internet > Network Connections

  2. Right click your main LAN

  3. Click Properties > Internet Protocol Version 4

  4. Click Properties > Advanced

  5. Uncheck 'Automatic Metric'

  6. Enter 10 in 'Interface Metric'

  7. Click OK

Upvotes: 9

ewalel
ewalel

Reputation: 2086

May be your network doesn't support LAN communication. Switching LAN to Local worked for me. From your MAC you can go to http://localhost:[portnumber] As shown in the picture below.

enter image description here

Upvotes: 7

Tadiwanashe
Tadiwanashe

Reputation: 1304

Maybe this might be helpful to simply explain that, such an error occurs if your phone and your computer are on different networks.

I resolved this issue by tethering and that way, my two devices were not on the same network.

Which means probably you can connect both your devices to the same WiFi it should work.

Upvotes: 0

for some reason I was creating conflicts with docker, I disabled it and it worked without problems, I'm almost sure it's hyper-V

Upvotes: 0

P Fuster
P Fuster

Reputation: 2334

If anyone is having a similar problem, my issue had to do withasking to allow node.js to connect with the network appeared, and it worked.

Upvotes: 0

Roman
Roman

Reputation: 21775

I solved the same problem with recomendation from React Native team - to instal and run Genymotion software::

  1. Install Genymotion with VirtualBox
  2. SignUp at Genymotion site
  3. Run Genymotion software and !!!SignIn
  4. Close npm prompt program with project and start it again
  5. npm start (in the npm promt window in the project directory)
  6. Close and start Expo app, scan barcode

If my application runs successfully IpV addresses are identical, for example:

exp://10.0.0.125:19000   and
ipconfig -> IPv4 Address. . . . . . . . . . . : 10.0.0.125

Upvotes: 0

Related Questions