Skip to content

development server is not started while scanning the QR code in Expo client application #270

Closed

Description

@San10694

Description

I recently started to learn React-Native and created a CRNA project.
whenever I scan the QR code in Expo App , the application is not started on my android device though my mobile is connected to same wireless network as my PC (windows)

Expected Behavior

I tried to run "npm start" in command line.code compiled successfully and QR code generated in command line.Whenever I scan this code through Expo app it is not starting my apllication in android device.

Observed Behavior

I got following error

Something went wrong.
could not load exp://192.168.*.**:19000. Network response timed out.
error-log---
uncaught error:java.net.SocketTimeoutException: failed to connect to /192.168.*.**(port 19000) after 10000ms 

Environment

  • react-native-scripts:--react-native-scripts@0.0.31
  • react-native:-- react-native@0.44.3
  • expo:-- expo@17.0.0
  • node -v:v6.10.1
  • npm -v:3.10.10
  • yarn --version:N/A
  • watchman version:
  1. Operating system:windows-10
  2. Phone/emulator/simulator & version:android v 6.0

Activity

  1. danielkcz commented on Jun 25, 2017

    @danielkcz

    Hey, I am trying very same thing and failing with same error as well. Here are the versions in my case. I am really just starting to know React Native. I haven't done any change there, just clean run of create-react-native-app (no errors during that).

    react-native-scripts@0.0.40
    react-native@0.45.1
    expo@18.0.4
    node@6.10.1
    npm@3.10.10
    yarn@0.24.6

    Windows 10 Pro x64
    Android 6.0 (LG G3)

    Tried disabling Firewall it case it's blocked there, but no luck. I don't have any active antivirus protection.

  2. danielkcz commented on Jun 25, 2017

    @danielkcz

    Found a troubleshooting section in readme on this and tried http access. This works and yields this result

    // 20170625170940
    // http://10.0.75.1:19000/
    
    {
      "sdkVersion": "18.0.0",
      "name": "mapper",
      "slug": "mapper",
      "version": "0.1.0",
      "xde": true,
      "developer": {
        "tool": "crna"
      },
      "packagerOpts": {
        "hostType": "tunnel",
        "lanType": "ip",
        "dev": true,
        "strict": false,
        "minify": false,
        "urlType": "exp",
        "urlRandomness": null
      },
      "env": {
        
      },
      "bundleUrl": "http://10.0.75.1:19001/./node_modules/react-native-scripts/build/bin/crna-entry.bundle?platform=ios&dev=true&strict=false&minify=false&hot=false&assetPlugin=expo/tools/hashAssetFiles",
      "debuggerHost": "10.0.75.1:19001",
      "mainModuleName": "./node_modules/react-native-scripts/build/bin/crna-entry",
      "logUrl": "http://10.0.75.1:19000/logs",
      "id": "@anonymous/mapper-183ba25c-82ec-44fa-835f-05f67178c163"
    }

    On the same address but 19001 port there is only a message React Native packager is running..

    Trying to access same address on the phone doesn't work, it cannot connect. I also tried connecting my computer to a wifi hotspot created on the phone. Same result.

    Also noticed the url http://10.0.75.1:19000/logs in the output above, but that doesn't work either (on a computer).

    Honestly, I don't think that IP address is a correct one there. I am not sure how is that obtained, but my network runs on regular 192.168.0.XXX addresses. How can my phone find that IP address?

  3. San10694 commented on Jun 26, 2017

    @San10694
    Author

    @FredyC I got an alternative for same problem
    please download "Expo XDE" (desktop application) it will definately solve your problem.
    following steps you need to follow
    1-download Expo XDE for your appropriate OS(ie. windows or mac) from https://expo.io/
    2-open Expo XDE and you will find your CRNA project , click on specific project you want to run ,,
    3- click on the gear icon in address bar and select host as a Lan , here you will find your "ipAddress:host"
    paste this address to your expo mobile App in explore section
    and if everything is right then you will get your application running on your mobile .....
    hope it will help you

  4. San10694 commented on Jun 28, 2017

    @San10694
    Author

    thanks @brentvatne,
    but unfortunately I got same error after setting enviornment variables. Only solution I got so for is to run my CRNA app in "Expo XDE" as I explained in my above comment .
    thanks for the help buddy

  5. danielkcz commented on Jun 29, 2017

    @danielkcz

    Ok, I think I've found the culprit. I have a Docker installed which has its own network adapter. For some reason the Expo picks this virtual network over the real one. Using env variable as @brentvatne suggested works, but it's totally cumbersome solution.

    I am wondering if this could be somehow configurable per project.

  6. ide commented on Jun 29, 2017

    @ide
    Member

    @FredyC One thing that might achieve a lot of what you are looking for is to use direnv (https://direnv.net). When you have direnv installed on your computer and set up in your shell profile, it will check for a file called .envrc, which is just a Bash script, in every directory you cd into.

    So you could make a file at ~/your-project/.envrc with export REACT_NATIVE_PACKAGER_HOSTNAME=$(hostname) and it would apply only when your terminal is in your project directory (or one of its subdirectories).

  7. ahmetkakici commented on Jun 30, 2017

    @ahmetkakici

    Today i got the same error (Network response timed out.) also couldn't access packager's address from iphone's browser.
    The problem was packager gets the first network adapter's local address (for me it was virtual-box adapter) 192.168.56.1 but my wireless network's local address was 192.168.1.28
    So instead of scanning url, i manually entered exp://192.168.1.28 to expo ios-app and it worked.

  8. danielkcz commented on Jun 30, 2017

    @danielkcz

    Yea, in the end, I've solved the problem by changing priorities of my network adapters so the one I want is a first one. Works like magic :)

  9. danielkcz commented on Jun 30, 2017

    @danielkcz

    Anyway, in my opinion, this should be solved on the Expo side to allow to pick which adapter to use. It's not always feasible to switch adapters priorities, in particular for people moving between e.g. wifi and wired connection.

  10. brentvatne commented on Jun 30, 2017

    @brentvatne
    Member

    @FredyC - I don't know much about network adapter priorities and have never encountered this issue myself -- would you be interested in helping us handle this on the Expo side?

  11. danielkcz commented on Jun 30, 2017

    @danielkcz

    @brentvatne Sure thing, just let me know what do you need from me. I am not sure about the way how Expo is finding that IP address. If you have access to a list of adapters of there is some high-level API only.

  12. GJS153 commented on Jul 6, 2017

    @GJS153

    I have tried all the suggestions listed above, but none of them worked. Here the error message that I got on my phone: "Uncaught Error: java.net.SocketTimeoutException:connect timed out"
    Could someone help me out?

  13. brentvatne commented on Jul 25, 2017

    @brentvatne
    Member
  14. danielkcz commented on Jul 25, 2017

    @danielkcz

    @brentvatne Ok, I see. The ip.address() allows specifying the name of the network adapter in a first argument. So if Expo can read that optionally from some config, it could solve all problems.

  15. 2 remaining items

  16. anp commented on Oct 17, 2017

    @anp
    Contributor

    @davidsickmiller I agree that some of these solutions would be very good. Implementing any of them will require some effort on the Expo client side, and we're tracking that work over there.

    Until we have these network reliability features impl'd (which we're tracking on the client roadmap), I believe setting REACT_NATIVE_PACKAGER_HOSTNAME will work for all of the issues raised in this thread, so I'm going to give this a close. Thanks!

  17. fraylopez commented on Oct 23, 2017

    @fraylopez

    Just in case it may help someone. In Windows 10, after looping through all workarounds on this thread with no luck I've managed to get it working by disabling and re-enabling the wifi connection. Besides from the firewall rules, every other setting is out of the box.
    It's worth to say that at some point I reset the network settings as well, which cleans all your wifi passwords among other net stuff, proceed carefully.

  18. bbeckk commented on Nov 11, 2017

    @bbeckk

    I disabled all the virtualBox adapters and then it worked

  19. danielkcz commented on Nov 11, 2017

    @danielkcz

    @bbeckk You are most likely having same issue as me and instead of disabling you can change network adapter priorities ... #270 (comment)

  20. gbarkhatov commented on Dec 8, 2017

    @gbarkhatov

    It was an issue for me. Having latest versions/updates of everything. Win10, vmware, vbox, create-react-native-app.

    Tried disabling and enabling the firewall.

    Though it worked from Expo XDE, I just felt like it should work on CLI.

    So the issue was (as described earlier by @ahmetkakici) that yarn start was using vmware network adapter.

    I went to the settings of my wi-fi adapter and changed metrics on TCPIP4 to 2
    https://www.ghacks.net/2016/12/02/change-network-adapter-priorities-in-windows-10/

    Now CRNA with yarn start points to the proper IP and everything is working from CLI

  21. nickcarenza commented on Jan 10, 2018

    @nickcarenza

    For me this was caused by the port range not being accessible.

    To solve, I made a .exprc file like this:

    {
    	"manifestPort": 8000
    }
    

    It seems to be an undocumented config file.

  22. evanslight commented on Jan 28, 2018

    @evanslight

    I solved this issue through updating my iPhone expo app. It worked smoothly.

  23. joshuachinemezu commented on Feb 25, 2018

    @joshuachinemezu

    Stopped my xampp server and it worked like magic

  24. gusleo commented on Mar 20, 2018

    @gusleo

    remove security apps on phone working for me

  25. aliraza4167 commented on Apr 4, 2018

    @aliraza4167

    Yes the problem was that I had VirtualBox installed and it had its own virtual network adapter. Disabled it and ran "npm run android" and it worked.

  26. ZulqarnainSyed commented on Apr 13, 2018

    @ZulqarnainSyed

    @FredyC Thanks for your insightful answer. I had a similar problem as there was a virtual connection of VmWare running. Thanks

  27. hulk-pham commented on Jun 24, 2018

    @hulk-pham

    In my case, I try
    set REACT_NATIVE_PACKAGER_HOSTNAME='localhost'
    and it worked

  28. anp commented on Jun 27, 2018

    @anp
    Contributor

    Hey everyone! This particular issue has been resolved for a while now. If you're still having issues with a similar message and have tried the solutions in this thread, please open a new issue. Thanks!

  29. locked as resolved and limited conversation to collaborators on Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions