Switched to new computer, now I can't open our app using Expo Go: "127.0.0.1 refused to connect"


Android device

Problem:

  • I’m working on a new laptop and I can’t open any expo/react native projects using Expo Go. I tried scanning the QR code that is in ‘Tunnel’, ‘LAN’, ‘Local’ and I still can’t connect to the development server.

What I’ve tried so far:

  • Install/Uninstall expo cli/nodejs
  • Set Execution-Policy to Unrestricted
  • Added REACT_NATIVE_PACKAGER_HOSTNAME in Environment Variables>System Variables(I’m not familiar with this one, but it seems that it doesn’t do anything or I’ve applied it wrong)
  • Turn off all firewall

node v16.14.2
expo v5.3.0

Hey @rxprmchs, can you try clearing your caches and also share what expo diagnostics spits out here?

Hi everyone! It seems that adding REACT_NATIVE_PACKAGER_HOSTNAME(Replacing 127.0.0.1 with my actual IP) in the environment variable does not do the trick, but setting it inside the “app/project’” works for me.

I opened our project in VSCode > Open new terminal > then execute:

set REACT_NATIVE_PACKAGER_HOSTNAME={added my/your IP here}

After that, I run npm/expo start and it showed my IP in the link instead of 127.0.0.1 and I can now connect to the development server! :slightly_smiling_face:

Hi! Already cleared my cache and even removed node_modules and package.lock. But I’ve already found a solution. :slightly_smiling_face:

You could also try:

expo start --lan

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.