Saeid Irvani
Saeid Irvani

Reputation: 53

Expo dev-client on iOS simulator Mac cannot connect to development server

My two apps stopped connecting with metro overnight. Local IP address hasn’t changed.

When I run them with "npx expo start --dev-client” as I always do, they both sit on the splash screen with a message banner saying "loading from metro..." And then after a while I get the white error screen with "could not connect to development server". This obviously means there’s a connectivity problem but I’ve spent all day verifying everything and trying to troubleshoot it to no avail. And the only thing I find on the web is related to IP change.

I’ve noticed that it works only once when I just start VSCode. If I try to run my second app it won’t work. Even if I close the running app and try it again it won’t work. If I restart VSCode, again it works once and no more. It’s as if VSCode is set to allow one Node server per session.

The only thing different between the time that it worked and it stopped working is my VSCode updated to 1.88 yesterday morning. It doesn’t make any sense that that’s the culprit, but that’s the only thing that’s different.

  1. The local IP has not changed. I’ve verified it.
  2. There are not proxies or firewalls.
  3. The development menu on the iOS simulator shows the right address and port. Fetching development servers on the simulator (refresh) comes back with the same address with a green dot so obviously it’s finding the server.
  4. Tapping either the one with the URL (http://192.168.86.51:8081) or even entering the same URL manually with the IP or "localhost" still won’t connect.
  5. Navigating on the simulator’s browser to my app’s REST server on the same local machine brings up the right page. So WiFi or IP don’t seem to be the culprit.
  6. I’ve removed node-modules and package-lock.json.
  7. I’ve removed the hidden .expo folder from both projects.
  8. I’ve removed both apps and reinstalled the simulator builds from Expo.
  9. I’ve tried both apps on different versions of the simulator/iOS.
  10. expo-cli —version is 6.3.10.
  11. expo version is ^50.0.7.
  12. Ran npx expo install —fix
  13. npx expo start -c —dev-client

I'm all out of ideas.

Upvotes: 1

Views: 690

Answers (0)

Related Questions