Network Response Time Out Error (create-react-native-app) (expo)

I am trying to run create-react-native-app on expo app in android.

Firstly ,I created the project by writing command

create-react-native-app test

then I executed

npm start

then scanned the qr code from expo app.

But after scanning QR code , I am getting following error:

Uncaught Error: Java.net,sockettimeoutException: failed to connect to after 10000ms

enter image description here

Github Issue:

https://github.com/react-community/create-react-native-app/issues/144#issuecomment-296631692


Solution 1:

This is due to not open port from your machine.

Linux (Ubuntu)

In Ubuntu Run In terminal

sudo ufw status verbose To view open port if you cannot found 19000 port open then you need to open port using

sudo ufw allow 19000/tcp

and then again run

sudo ufw allow 19001/tcp

to serve http for react native i solve this problem in my ubuntu using this method. I hope this will help you.

Windows

To open a port in the Windows firewall for TCP access 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 Specific local ports, and then type the port number of the instance of the React port, such as 19000 for the default instance. 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.

Similarly you can open port 19001 too.

Solution 2:

I wasted my whole day searching for answer and finally i got solution accidentally. Just change connection from LAN to tunnel

Below is the image,

enter image description here