Afsanefda
Afsanefda

Reputation: 3339

Expo app - can't load project with message : This is taking much longer than it should

I build my react native app in this way :

1.npm install expo-cli --global.

2.expo init my-new-project.

3.cd my-new-project and expo start --lan.

4. install expo on my ios device.

5. open Expo then click the “Scan QR Code” and Scan the QR code in our terminal.

but I get following error :

error

I am connected to the same wifi on both devices and my IP is the same. And I turned off my windows firewall.

Do you know why this happens? I once saw the output on my phone but after that this error occurs every time.

Upvotes: 21

Views: 34379

Answers (18)

Nithya Rajan
Nithya Rajan

Reputation: 4884

For those who is not aware of what tunnel is:

just add the --tunnel flag in your expo start command

expo start --tunnel --port 19000

this will install ngrok & create a tunnel for you to connect via mobile easily and maintain the connection properly.

this will solve your blue screen "something went wrong" issue in expo app.

I hope it's helpful for you.

Upvotes: 0

Jack
Jack

Reputation: 2223

On my mac, I still had this issue even with the firewall disabled - it turned out that I needed to turn on Internet Sharing in system settings.

Upvotes: 0

medAmineRg
medAmineRg

Reputation: 21

If someone still encountering this problem, just go to the Wi-Fi settings on the iPhone and disable the private Wi-Fi address. That will do the job!

Upvotes: 0

Jahid Hassan
Jahid Hassan

Reputation: 1

Try restarting your phone as well. I tried all the solutions including "expo start --tunnel". But it was not working. Then I restarted my phone. Now it's working

Upvotes: 0

Matias
Matias

Reputation: 11

As a ubuntu user I realized that ufw was blocking this port. What I did was run sudo ufw allow 8081. Use that command with your expo port or simply but more insecure, run sudo ufw disable.

Upvotes: 1

Farid shahidi
Farid shahidi

Reputation: 352

You have to make sure all of these list items are done:

  1. same network for your mobile and your pc
  2. active private network in your pc windows
  3. make sure firewall is off in your pc
  4. login to expo cli with same account you are loggedin inside expo go in your mobile
  5. make sure you are not using vpn in both mobile and pc
  6. make sure expo cli package is updated, also run expo upgrade

Upvotes: 0

todofixthis
todofixthis

Reputation: 1142

  • Make sure that your computer and phone are on the same network.
  • On Windows, change your Wi-Fi network trust level to Private instead of Public, but only if you trust this Wi-Fi network! E.g., you can make your home Wi-Fi network private, but don't do this if you're at a café, coworking space, etc.
  • Check that port 19000 is open on your computer's firewall.
    • You can try disabling the firewall to test if that's what's causing the problem, but as a permanent fix it's much safer to open only that specific port.
    • On macOS, if you've recently updated your installed version of NodeJS, try deleting and recreating the firewall rule for node:
      1. Stop the expo server, if it is running.
      2. Open System Preferences → Security & Privacy → Firewall.
      3. Click the lock icon in the bottom left corner and enter your password to unlock the interface.
      4. Click the Firewall Options button.
      5. Locate node in the list of application rules, click on it, and then click the - button to remove it.
      6. Click the OK button.
      7. Restart the expo server, and click "Permit" in the dialog box that appears asking if the firewall should allow incoming connections for node.
  • If you are running VPN software on your phone and/or laptop, try disconnecting/disabling it.
    • Depending on your VPN software, you may be able to add your local network to an allowlist (example for NordVPN).
    • If your VPN has a kill switch feature, you may need to disable it.
    • You may need to explicitly quit the VPN app, not just disconnect/pause the VPN connection.
  • If you're running Windows Subsystem for Linux, you'll need to install a script to install network forwarding
    • Check out wsl2-hacks for more tips and tools for using WSL as your development environment.
  • If you've got an Android phone, you can use Android Studio to connect to your phone over USB. See How to connect Expo to USB Android Device for more information.
  • If your computer has decent memory and processing power, you could run the app in a simulator.
  • As a last resort, try running the server in "tunnel" mode: npm run start -- --tunnel
    • You'll need to install Android Studio in order to make this work.
    • Note: Using the "Tunnel" connection type will make app reloads considerably slower than on "LAN" or "Local", so it's best to avoid tunnel when possible.

Upvotes: 0

Juan
Juan

Reputation: 361

I had the same problem, entered to Settings, Network, Wi-Fi, Show Available Networks, Properties on your internet connection, and click on Private. Then it worked, I hope it serves to you too.

Upvotes: 26

Diesan Romero
Diesan Romero

Reputation: 1658

In my case there was a VPN connected. Make sure you're using the same local network in order to use LAN option for expo.

Upvotes: 0

EllaBella515
EllaBella515

Reputation: 61

Firewall settings mac os

  • MacOS Monterey
  • iPhone

None of the posted solutions were fixing the problem, this is what ended up doing the trick:

  1. System Preferences ->

  2. Security & Privacy ->

  3. Firewall (tab) ->

  4. Firewall Options... (button) ->

  5. scroll down to node in the left column and change the corresponding dropdown to read 'Allow incoming connections'

  6. I then closed out the previously opened server in my terminal, turned off the wifi connection on both of my devices.

  7. Once I ran everything again and scanned the new QR in my terminal, the app loaded.

Upvotes: 6

Leonardo
Leonardo

Reputation: 31

Your firewall is most likely the problem. It may be blocking your phone's connection to your computer.

On Windows: Settings > Network and Internet > [Ethernet || WiFi] > Network > Network Profile [Private] > Configure Firewall and Security Settings > (Settings is trying to open Windows Security) [Yes] > Private Network > Microsoft Defender Firewall [Off]

Now expo should work through LAN.

Alternatively: On the expo developer tools, switch to tunnel.

Upvotes: 3

Vlad L
Vlad L

Reputation: 1695

I had this problem on an iPhone - it was working fine for at least a month until suddenly it couldn't connect. It could still connect using the 'tunnel' option, but not LAN.

Interestingly, the iPhone COULD connect to a different PC, and at the same time a different device could connect to Expo on the machine that was problematic for the iPhone.

After trying lots of other things, I uninstalled and re-installed Expo Go app on the phone and it started working again.

Upvotes: 0

Billy Baggins
Billy Baggins

Reputation: 46

I had the same problem. I disconnected from my wifi network, reconnected and it started working.

Upvotes: 1

S4RUUL
S4RUUL

Reputation: 141

you have to login on you pc with your expo account

Upvotes: 0

user177468
user177468

Reputation: 255

Connect your phone to the same WIFI network and it should work.

Upvotes: 2

Cão
Cão

Reputation: 641

I was having having the same issue. Switched to tunnel connection and it worked.

Upvotes: 31

kyldu
kyldu

Reputation: 187

I had this problem as well and was able to solve it. If you have a program like docker installed, it will create a virtual network adapter, Expo will then try to use this virtual network adapter to host the app. You want Expo to use your physical wifi/ethernet adapter in your computer instead, since that will allow it to communicate with your phone (which is on the same network).

You can solve the problem by changing the adapter properties to ensure that Expo uses the right network adapter to host your development environment:

https://answers.microsoft.com/en-us/windows/forum/windows_10-networking/adapter-priority-setting-unavailable-in-windows-10/d2b63caa-e77c-4b46-88b5-eeeaee00c306?auth=1

Restart your Expo server and try again once you complete the steps in the link above.

Upvotes: 8

Atin Singh
Atin Singh

Reputation: 3690

I think you should scan the QR code from the dev tools that run on localhost from browser. Also the Expo app in Ios doesn't have a scan QR code option, if I am not wrong. We run apps by scanning QR code directly from Camera and opening it using Expo app. From my personal experience the QR code shown in terminal causes problems as we save changes to app.

Upvotes: 0

Related Questions