Search code examples
androidreact-nativewindows-firewall

Windows Firewall issue when connecting from expo


I am having windows firewall issues connecting to the react-native packager from expo on both the VS android emulator and an Android hardware device.

The error I am getting in Expo is "Uncaught Error: Packager is not running at http:/192.168.1.8:19001".

This is not the usual connect issue you have with Expo as documented in Could not load exp:// Something went wrong . I've already lain on that bed of pain. I now have my environment variable set up like so...

set REACT_NATIVE_PACKAGER_HOSTNAME=192.168.1.8

This is something entirely new. Everything was working fine up to the last windows update. The reason I know it is a windows firewall issue is that when I turn off the firewall everything starts working.

But this is not a fix. I would really like to turn my firewall back on. I've looked at the firewall rules and I see Expo XDE and Node.js in the inbound rules.

What is the real fix for this? I have a feeling a lot of people are suddenly having this issue.


Solution

  • Ok. So the problem turned out to be multiple installations node.js. My firewall had rules for one installation of node.js while react-native was using another installation.

    So the firewall had inbound rules for a node.js installation that was installed by Visual Studio. This installation was older then the newer installation of node.js which I installed as a part of getting react-native working.

    So to fix the problem I had to change the inbound firewall rules for node.exe to specify a path to the newer rather than the older installation of node.exe.

    The remaining mystery is why this suddenly became a problem when react-native had been working fine. I suspected the most recent windows update but I don't see any changes to Windows Firewall in that update.

    So what I learned: (1) even though Windows Firewall has notifications on, it doesn't notify you when blocking an inbound connection for a process named in an existing rule; (2) I really need to pay attention to multiple installations of the same tool set. Multiple installs of node.js was the root issue in this problem and I recently had issues with multiple installs of the Android tool adb.exe