Expo, java.net.SocketTimeoutException:failed to connect
Asked Answered
A

7

7

am new to React native Expo I need to add some new modules on my project. "expo": "33.0.0", "react": "16.8.3", whenever I try to run my project am getting Error am not able to run the project. I tried all way to run the project like set REACT_NATIVE_PACKAGER_HOSTNAME='192.168.0.102', firewall off, allowed inbound 19000 port etc. but am getting error.

when I enter expo start -c

 Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo install [package-name ...]
Starting Metro Bundler on port 19001.
Your JavaScript transform cache is empty, rebuilding (this may take a minute).
Your native app is running at exp9c305c55e38f4d0e856f59397620314e://192.168.0.101:19000
Logs for your project will appear below. Press Ctrl+C to exit.

then my laptop and mobile is connected with same network and same IP but am getting error and i don't know the port 19000 is different from my wifi

Uncaught Error:java.net.SocketTimeoutException:failed to connect to/192.168.1.20(port 19000)from/192.168.0.102(port 49615) after 10000ms

Please give some solution for it.

Annexation answered 10/12, 2020 at 6:45 Comment(0)
P
8

It's failing because port 19000 is not open in your firewall. If you use linux OS open this port by running:

sudo ufw allow 19000/tcp
Propensity answered 30/12, 2020 at 14:24 Comment(1)
NO, actually its open in firewall but mostly it will connect with port 80,19001. I don't no why?. AM using Windows 10Annexation
L
2

enter image description hereFirst Check are you in tunnel connection? If you are in tunnel connection then

First : ipconfig

then : set REACT_NATIVE_PACKAGER_HOSTNAME=192.168.1.103 (IPv4 Address)

then:npm start

It worked for me. Hopefully it will help.

Livia answered 29/3, 2021 at 18:8 Comment(1)
Yeah, its worked in mac but in windows not workingAnnexation
D
1

I resolved this by changing the network profile on the connected wifi from private to public.

Expo Error Fix

Drawers answered 24/1, 2022 at 16:29 Comment(1)
I'm using public wi-fi but have the same problem.Phocine
P
1

i don't know if you still getting this problem but clearing the expo app solved form me just run expo r -c

Pastern answered 16/3, 2023 at 13:26 Comment(0)
P
1

If the other options listed here don't work for you on Windows 10, updating the Windows firewall settings for allowing Expo Go to communicate with the development server should work:

  1. Press the Windows key, type "Windows Defender Firewall," and click on "Windows Defender Firewall with Advanced Security."

  2. In the left pane, click on "Inbound Rules."

  3. Click "New Rule..." in the right pane.

  4. Select "Port" and click "Next."

  5. Select "TCP" and enter "19000-19002" in the "Specific local ports" field. Click "Next."

  6. Choose "Allow the connection" and click "Next."

  7. Ensure that all three network types (Domain, Private, and Public) are checked, and click "Next."

  8. Enter a name for the rule (e.g., "Expo Go Ports") and click "Finish."

Repeat steps 2 to 8 for "Outbound Rules" to create a new rule for outgoing connections.

After updating your firewall settings, restart Expo CLI and try connecting your mobile devices again.

Postulate answered 24/4, 2023 at 21:14 Comment(0)
U
1

In my case it was an issue with Windows 10 Firewall. I did these steps:

  1. Windows Security -> Firewall & Network Protection - Restore firewalls to Default;
  2. Opened up Windows Power Shell and CD into my Expo app folder;
  3. Ran: npm run start (in this step Windows Firewall will ask you if you allow this app in the firewall)
  4. Choose to allow and include Private and Public Networks.

Done!

Unconformity answered 14/2, 2024 at 2:16 Comment(0)
S
0

Instead of changing a bunch of settings with the firewall and network settings, I found success with running start with the --tunnel flag.

On Windows Subsystem for Linux (WSL) I used:

npx expo start --tunnel
Schwa answered 21/8, 2024 at 16:6 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.