rahulserver
rahulserver

Reputation: 11205

React native Unable to connect with remote debugger ECONNREFUSED

I understand that this has been asked many times before but none of the solutions work for me. Here is the screen grab of my device(android 6.0.1 samsung J210F): enter image description here

When I open localhost:8081/debugger-ui I get this message: enter image description here

So debugger is running on 8081. BUT it gives this message on console: enter image description here

The reverse tcp command has already been executed by the debugger: enter image description here

(The full error that got clipped was Error running 'RN': timeout on waiting for connection to React Native packager. Make sure you have selected 'Debug JS Remotely' from the Developer Menu. I have already selected "Debug JS Remotely" from developer menu so I don't think thats the reason.

I hope I provided all the information. Have been struggling for hours to solve this.

Upvotes: 10

Views: 12575

Answers (5)

Jay Dwivedi
Jay Dwivedi

Reputation: 464

I think You are using Emulator. So here after installing your app on emulator press cmd+m or ctr+m , you get the debugging option. Here select -> change location path-> Please paste your system local host url along with port like -> 127.0.0.1:Port

Please dont use localhost:port

Upvotes: 0

Erkan Kılıç
Erkan Kılıç

Reputation: 87

If you are trying it on your own device, shake your phone left and right to open the debugger menu. then the error goes away.

Upvotes: 0

MaxPower
MaxPower

Reputation: 367

Just incase anyone comes across this, I ran into this problem and none of the above solutions worked for me.

I was building my app to my pixel 2 and trying to get chrome debugging working and kept getting this error.

What worked for me: Shake your phone to pull up the RN menu. Click on dev settings. Inside dev settings, click on 'Debug server host & port for device'

here make sure its your machine ip address followed by port 8081. If youre on a mac, you can find your machine ip by going to system preferences --> network --> and under 'status: connected' you will see the IP address info. Make sure your device and mac are on the same wifi network.

Going back to 'Debug server host & port for device' input '10.0.1.1:8081' (replace 10.0.1.1 with whatever your machine ip was).

Reload your build, and then click Debug JS remotely. These steps worked for me.

Upvotes: 2

kamal11
kamal11

Reputation: 384

Just run the command adb reverse tcp:8081 tcp:8081 and then run react-native run-android. The problem would be solved.

Upvotes: 12

Vijay Vavdiya
Vijay Vavdiya

Reputation: 1309

Before enabling remote debugging on your emulator, open http://localhost:8081/debugger-ui in chrome. Then enable remote debugging and go back to the chrome page where you should see your console logs.

Reference

Upvotes: 4

Related Questions