16

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.

piet.t
  • 11,718
  • 21
  • 43
  • 52
Afsanefda
  • 3,069
  • 6
  • 36
  • 76

13 Answers13

23

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.

DonQuijote
  • 47
  • 8
Juan
  • 331
  • 2
  • 3
21

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

Cão
  • 521
  • 5
  • 7
8

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.

kyldu
  • 187
  • 1
  • 12
4

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.

  • Thanks! It happened to me after I updated to Monterey. It looks like the update configures the Firewall to block all incoming connections. – Ferran Maylinch Mar 21 '22 at 14:33
2

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.

Leonardo
  • 21
  • 1
  • `expo start --tunnel` worked for me. I disabled NordVPN on both my Macbook Pro and my Android. I have since enabled NordVPN again. Everything seems to be working fine. – Jamie Bort May 08 '23 at 20:48
1

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

user177468
  • 225
  • 5
  • 18
1

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

0

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.

Atin Singh
  • 3,624
  • 2
  • 18
  • 25
0

you have to login on you pc with your expo account

S4RUUL
  • 141
  • 1
  • 3
0

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.

Vlad L
  • 1,544
  • 3
  • 6
  • 20
0

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.

Diesan Romero
  • 1,292
  • 4
  • 20
  • 45
0
  • 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.
todofixthis
  • 1,072
  • 1
  • 12
  • 25
0

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
Farid shahidi
  • 318
  • 4
  • 9