0

I'm trying to get better debugging with React Native using react-devtools

npm install -g react-devtools && react-devtools*

But it always show connecting...
It doesn't work

Mehdi Dehghani
  • 10,970
  • 6
  • 59
  • 64
xingxuan
  • 13
  • 3
  • 1
    Please give more details of the steps you have tried so far. Also: Do react-devtools work in conjunction with a browser extension that you do not have installed? – sapanoia Jan 14 '18 at 16:40
  • Possible duplicate of [How do you debug react-native?](https://stackoverflow.com/questions/29289304/how-do-you-debug-react-native) – Syed Zain Ali Jan 14 '18 at 17:45
  • 1、 in terminal, react-native run-ios 2、 command + d open Debug JS Remotely 3、 in project root directory, in terminal , react-devtools – xingxuan Jan 15 '18 at 08:11

2 Answers2

0

Under the scripts section in your package.json, add the following:

"debug": "react-devtools"

Then run npm run debug from your project directory. Your app should now connect.

You can also look into React Native Debugger which is a bit easier to use (in my opinion).

Adam Kipnis
  • 10,175
  • 10
  • 35
  • 48
  • it doesn't work , maybe my steps are wrong? 1、 react-native run-ios 2、 open Debug JS Remotely 3、 npm run debug – xingxuan Jan 15 '18 at 08:20
0

If you are trying to debug an attached device:

Make sure the device is connected via adb

adb devices

Ensure adb reverse is enabled for port 8097

adb reverse tcp:8097 tcp:8097
react-devtools

I've found the following 2 pages very useful:

http://facebook.github.io/react-native/docs/debugging

https://facebook.github.io/react-native/docs/running-on-device