19

When I make changes and save them, the app in my emulator is not being refreshed; the emulator is not connected to the metro server I think.

I tried to clear cache by running expo -r -c, but this didn't do any thing.

5
  • did you try to rerun npm? npm add expo . and then run it as npm start .
    – 0xA
    Jul 4, 2020 at 17:43
  • Actually, this happen to only one project, when i am working on another project there is no problem. And yes; i did that but no changes(npm add expo). Jul 4, 2020 at 17:56
  • well what did you do ? did you add/install any packages that can cause conflict? like react-native-fast-referesh, ejected that project, watchFolders and sourceExts maybe, rebuilding with ts, try i’d suggest trying to create a new project then slowly add your config, restarting and clearing the cache each time, until you find the piece that causes this problem from the expo team forums.expo.io/t/expo-fast-refresh-no-longer-working/31904
    – 0xA
    Jul 4, 2020 at 18:02
  • Thanks for your help. I solved the problem and i think that the solution was to update expo as you said it. Thank you again, it worked!!!! Jul 4, 2020 at 18:51
  • I had the same problem. Appearently it was watchman that was downloaded with admin privileges in powershell that did not download correctly somehow. So I reinstalled it in my vscode terminal in my react native project folder without admin (check out this to make sure you're doing it correctly docs.chocolatey.org/en-us/choco/…), and now it works! Dec 27, 2022 at 4:52

8 Answers 8

68

Did you try to enable the fast refreshing? I was having the same issue, but after I enable the "Fast Refresh" the auto refreshing started working again. To enable the fast refresh you just have to shake your smartphone and tap on "Enable Fast Refresh".

4
  • 3
    Note: If using an Android Studio emulator, press Ctrl + M to bring up the menu then click "Enable Fast Refresh."
    – GTS Joe
    Feb 6, 2021 at 23:25
  • Guess you need to rerun expo if you have any errors on enabling fast refresh for the first time. Apr 20, 2021 at 14:16
  • Great one, was getting tired of restarting whole app. Cheers Jan 10 at 17:58
  • There should be an option in Expo APP settings, shaking phone is rarely used :-) Mar 17 at 15:42
8

[Update 2022]

How wierd it sounds sometimes even with above or other solutions like I provided here at beginning that do not always works, sometimes expo seems just stack. A way that seems works, is to change connection type or just connection(from a wifi to another )

Initial answer:

Hope this would help others avoid waist time.

If the above solution won't work(Shake or refresh the entire Expo server) another 2 alternative are :

First option:

While being in the project directory where server is running Press:

 r  

│ --> it will reload the app

2 Option: Go to your device Settings find Expo Go and force stop or clean cache then reopen it. Unfortunately I noticed this not enough, start as well your metro server.

4

iOS Simulator: Hit Ctrl-Cmd-Z on a Mac in the emulator to simulate the shake gesture, or press Cmd+D. Then enable fast refresh in the menu

Android Emulator: Hit Cmd+M, then enable fast refresh in the menu.

That would do the trick

3

did you try to rerun npm? npm add expo . and then run it as npm start .

2
  • Unfortunately even this did worked for me, seems the expo application isn't handling the refresh properly Nov 9, 2021 at 16:59
  • An alternative if both shaking is not workig(as in my case in the Xiomi 10) neither restart the server on command line, is to go to mobile device setting and force stop of Expo Go. Then the Expo will show a refreshed or a error log that was basically what stopped the Expo, Nov 9, 2021 at 17:03
3

If you have recently updated Expo versions, you may need to update OR remove the overrides and resolutions part of your package.json that define what version of Metro it uses.

You can see what version you need by checking the dependencies in the package-lock.json. I found mine under: "node_modules/@react-native-community/cli-plugin-metro"

In my case, I had to switch from:

  "overrides": {
    "metro": "0.76.0",
    "metro-resolver": "0.76.0"
  },
  "resolutions": {
    "metro": "0.76.0",
    "metro-resolver": "0.76.0"
  }

Over to:

  "overrides": {
    "metro": "0.76.7",
    "metro-resolver": "0.76.7"
  },
  "resolutions": {
    "metro": "0.76.7",
    "metro-resolver": "0.76.7"
  }

Expo automatically uses the Metro version installed by npx expo install when you run npx expo start. Removing the override and resolution is probably the right fix for many cases because of this.

1
  • This was my solution, thanks
    – Mr Yar
    Sep 9 at 17:30
0

run npm start / expo start open the project on your emulator once the JavaScript bundling is complete and metro is ready.

if you are using and iOS emulator click on i if android click a

for windows use CTRL + M and on mac use command + M.

Select "enable auto refresh" on the avd or ios emulator. On that same option-menu select "stop remote debugging".

close any react native debugging mode on your browser tab

reload your emulator and resave your project, that should work

0

Something else that might cause this: if you use a VPN, the app might still work in Expo Go, but fast refresh won't.

So switch off your VPN and refresh the app in Expo Go manually. Fast refresh might work again (it did for me).

-3

Enable auto save if you are working von VS Code. It worked with me. 1- click on (file) at the top. 2- Click on (Auto Save).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.