create-react-native-app icon indicating copy to clipboard operation
create-react-native-app copied to clipboard

Timeout When Running `npm start`

Open d-xo opened this issue 9 years ago • 28 comments

Description

If I run npm start and then scan the qr code in the expo app, I always get a timeout error.

My phone and my laptop are on the same network.

Expected Behavior

  • create a new project with create-react-native-app
  • run npm start
  • scan shown qr code
  • expo app does not timeout.

Observed Behavior

  • expo app does timeout:
"Error while loading: The request timed out." (code -1001)

Environment

Please run these commands in the project folder and fill in their results:

Also specify:

  1. Operating system: NixOS 17.09
  2. Phone/emulator/simulator & version: iPhone 5s // iOS 10.2.1

d-xo avatar Apr 14 '17 23:04 d-xo

Hi! Thanks for the report! Have you tried the network troubleshooting steps in the user guide?

anp avatar Apr 15 '17 17:04 anp

Hi my phone and my laptop are on the same network but I tried to open, in my case http://192.168.56.1:19000/ on my phone and it doesn't reach the site.

kmiloarguello avatar Apr 18 '17 14:04 kmiloarguello

Have you fixed this issue? I still got the same error, My phone and laptop connected in the same network, I tried to access it in my phone chrome browser as mentioned in network troubleshooting steps. It didn't work.

sajankumar avatar Apr 18 '17 16:04 sajankumar

It might be a host issue. Inside of Expo XDE, I chose in config -> Host -> Tunnel with Protocol exp. The link to preview the app inside of XDS looks something like this exp://4n-g26.username.project-name.exp.direct:80. When I ran npm start finally I got something like this exp://192.168.56.1:19000. I don't know if this could be the problem. 😞

kmiloarguello avatar Apr 18 '17 17:04 kmiloarguello

@kmiloarguello @sajankumar did you try the steps from the network troubleshooting guide, including using your phone's tethering/hotspot? https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md#networking

anp avatar Apr 18 '17 20:04 anp

I tried, but it didn't work. Please see the attached screenshot whatsapp image 2017-04-19 at 7 10 15 am

sajankumar avatar Apr 19 '17 01:04 sajankumar

Thank you for the answer. Actually the problem doesn't the network. I guess I could be a XDE host problem. For example I tried to run my project inside of Windows using Expo XDE software and it only works when I run from this button Open on Android (see attachment screenshot).

22

kmiloarguello avatar Apr 19 '17 03:04 kmiloarguello

Any help would be highly appreciated :)

sajankumar avatar Apr 19 '17 07:04 sajankumar

@kmiloarguello if you're using open on android, that doesn't hit the network the same way as scanning a QR code or typing in a URL. You'll need to be more specific about what steps you're taking from the network troubleshooting guide.

@sajankumar you didn't mention whether you tried this in your phone's web browser. If you can reach the URL in your phone's browser, but not in the Expo app, that's definitely something we need to investigate. Unfortunately I don't have time to help with networking issues that aren't directly a bug in the Expo app :(. If you still think this is a bug, please detail what steps you took from the network troubleshooting guide.

anp avatar Apr 19 '17 18:04 anp

@dikaiosune Hey, I tried whatever the steps mentioned in this link https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md#networking didn't work. Unfortunately I can't reach URL in my phone's browser.

So, I thought it maybe because of my network firewall so I deactivated the firewall and tried it but it didn't work.

sajankumar avatar Apr 20 '17 07:04 sajankumar

I took all the steps from the network troubleshooting guide. Now it works for me, the problem was that my physical device wasn't be able to catch the same host url of XDE software. With the QR code scan was not possible to connect my device and XDE. The only way was send the url from XDE to the physical device.

kmiloarguello avatar Apr 20 '17 09:04 kmiloarguello

@sajankumar if you can't reach the URL in your phone's browser, there's unfortunately not much I can do to help. I'd recommend trying XDE out instead of CRNA, because it handles a number of these networking issues for you.

I haven't heard back from the original reporter, and as far as I can tell all subsequent reports are just due to local network configuration issues, which are out of scope for help and bug reports on this repo (sorry, just not enough time to address every single one!). Giving this a close.

If you're coming to this issue when searching around, please please please try the network troubleshooting steps in the user guide. If you can reach the server URL in your phone's browser, but not in the Expo app, please open a new issue. Otherwise, I'd recommend looking around for resources to change your local network configuration to support connecting between devices, or installing XDE which will create network tunnels for you.

anp avatar Apr 20 '17 17:04 anp

In my case, i solved this problem by changing default IP of CRNA to IP of my Windows PC . 192.168.56.1:19000 (default) to my pc IP.

https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md#configuring-packager-ip-address

meotimdihia avatar Apr 21 '17 09:04 meotimdihia

I just ran yarn ios start and get this error, from a brand new project today with latest versions.

image

quantuminformation avatar Jun 10 '17 11:06 quantuminformation

Note I am trying to use the simulator.

Previously the sim worked about 2-3 weeks ago.

quantuminformation avatar Jun 10 '17 11:06 quantuminformation

@QuantumInformation - can you open your browser to http://localhost:19000 and see what the result is?

brentvatne avatar Jun 12 '17 19:06 brentvatne

Maybe you could try to close windows(or other) firewall, it work for me.

MagicJohnJang avatar Jun 17 '17 09:06 MagicJohnJang

when vpn used in phone ,i came cross this problem. solved after vpn closed.

sindey1982 avatar Jun 22 '17 12:06 sindey1982

The problem is your OS firewall block access from your phone. Find your phone ip address in settings and allow on your PC/Laptop access (through firewall configuration) from phone ip to your PC ip address and ports 19000, 19001. On ubuntu with ufw firewall need to do something like: sudo ufw allow from phone.ip.address.here to pc.ip.address.here port 19001

mikhsol avatar Jul 31 '17 10:07 mikhsol

quick 1 liner: sudo ufw allow from 192.168.0.0/24 to 192.168.0.0/24 port 19000:19001 proto tcp

nunosilva800 avatar Sep 05 '17 18:09 nunosilva800