Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native Cannot connect to react-devtools using android simulator

I execute the project with react-native run-android and in another terminal, i do:

npm run react-devtools

and it opens the new window of electron that says:

The react native app it will open in a few seconds...

but nothing happens.

I put in the simulator toggle inspector with Ctrl + m and i can see in networks that it makes a request to http://localhost:8097 and the result is it fails to connect and keeps trying with the same result.

The window of electron that is open it says that it wait connections to the port 8097 so i can see is trying to connect but with no results!

like image 418
Franco Coronel Avatar asked Jun 15 '18 01:06

Franco Coronel


2 Answers

You need to run this command in a new terminal adb reverse tcp:8097 tcp:8097

like image 147
toxdes Avatar answered Oct 04 '22 17:10

toxdes


react-devtools v4 is incompatible with react-native

try version 3 instead of version 4: npm install -d -g [email protected], it's worked for me.

like image 20
Murilo Schmalfuss Avatar answered Oct 04 '22 18:10

Murilo Schmalfuss