question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debugging: Dev Tools launch to 10.0.2.2 instead of localhost

See original GitHub issue

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

yes

Environment

Environment: OS: macOS High Sierra 10.13.3 Node: 8.7.0 Yarn: 1.3.2 npm: 5.6.0 Watchman: 4.7.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) react: 16.2.0 => 16.2.0 react-native: 0.53.0 => 0.53.0

Steps to Reproduce

  1. Run app on Android.
  2. Turn on Debug mode.
  3. Bundler says “Launching Dev Tools…” and it opens chrome to http://10.0.2.2:8081/debugger-ui, which hangs because the debugger is on localhost.

Expected Behavior

I expect the debugger to open Chrome to localhost:8081/debugger-ui as it always has before I upgraded to version 0.53.0.

Actual Behavior

As mentioned, it opens to http://10.0.2.2:8081/debugger-ui, which is inoperable. Nothing ever loads. The Devtools middleware has the wrong host for some reason.

Reproducible Demo

You can literally react-native init a new app right now, and it will do this. Here’s a package json of an app I just generated that has this issue

{
  "name": "testingtesting",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.2.0",
    "react-native": "0.53.0"
  },
  "devDependencies": {
    "babel-jest": "22.2.2",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.3.0",
    "react-test-renderer": "16.2.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

It appears the app bundle is also being loaded from 10.0.2.2, but the debugger is not functioning at this host, which I’m guessing means that even if I navigate to a “working” debugger @ localhost, it’s still not going to work. Credit to #17910 for first assuring me I was not crazy and this was a real issue.

Edit: Complete shot in the dark here, but could it have something to do with fa574c6 ? (happy to pr this with some direction, although I know at least part of the issue is in a separate file where it is also incorrect about the host when launching chrome).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:63
  • Comments:70 (11 by maintainers)

github_iconTop GitHub Comments

112reactions
perseyMudzingacommented, Feb 14, 2018

Go to http://localhost:8081/debugger-ui/ . Then stop remote js debugging and run your react native app again. Finally debug js remotely. Has worked for me.

36reactions
sajibcse68commented, May 2, 2018

I solved the issue by:

  • Press Cmd + M on emulator screen
  • Go to Dev settings > Debug server host & port for device
  • Set localhost:8081
  • Rerun the android app: react-native run-android

Debugger is connected now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-native android debugger connecting to 10.0.2.2 instead ...
Press Cmd + M on emulator screen; Dev settings > Debug server host & port for device; Set localhost:8081; Rerun the android app:...
Read more >
Debugging Internet Explorer | Chromatic
With this setup, I've been able to access my local environment (by typing out http://10.0.2.2:3000 instead of localhost:3000 ) without ...
Read more >
Run functions locally | Cloud Functions for Firebase - Google
To run the Cloud Functions emulator, use the emulators:start command: ... 10.0.2.2 is the special IP address to connect to the 'localhost' of...
Read more >
Set up Android Emulator networking
The emulator provides versatile networking capabilities that you can use to set up complex modeling and testing environments for your app.
Read more >
Configure Xdebug | PhpStorm Documentation - JetBrains
To disable the Zend Debugger and Zend Optimizer tools, ... between it and PhpStorm is established (instead of running automatically until ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found