-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fast refresh not working in React Native 0.64.2 #32001
Comments
Just to add to this, if I run with sudo:
Then fast refresh works. If I do not, then fast refresh doesn't work. |
I was seeing fast refresh not working when going from react-native 0.63.3 to 0.64.0. Turned out the issue was 0.63.3 used to have fast refresh always enabled by default because of a bug (#29912 (comment)) which was fixed in 0.64. Now you need to go in the debug menu and turn it on using "Enable Fast Refresh". |
@jgolden thanks for the feedback. I tried that and it didn't work. Inside the running simulator (from XCode), I open the developer menu and disable then re-enable fast refresh. I then edit a file. What I would expect to see is that the running app refreshes (and I see a message to that effect inside the console). What I actually see is that there are no changes registered, and I need to kill |
You can access your debug menu to check whether it is enabled or disabled. If you have your "Fast Refresh", then it sometimes glitches according to your workspace setup and memory consumption. Therefore, continue reading the next section. Read Carefully! Do not just run the command!There's a workaround I sometimes use if the workspace is managed by rm ./.git/index.lock |
I saw that a lot of people suggested this, and that it had fixed the problem for them (but they didn't know why). In my case, I do have an I'm running the latest version of MacOS (11.5.1) |
I forgot to mention that running the command regardless of whether the file exists or not sometimes fixes the issue as well. It is really weird how it sometimes triggers the refresh to work. However, my opinion concerning this is an uneducated one but I would gladly share it up next. I believe that modifying the If this did not help, you could try to check watchman watch-del-all |
also happens in 0.65.1 please help with this issue |
This is still broken in 0.65.1.. I have to reload the metro to see any changes. It says "refreshing" but no actual changes are reflected. |
@mikehardy HI can you please help us with this issue due to this issue I cannot upgrade to the new version! |
I have no involvement in this issue @projectnetworld why did you tag me? So I can't reproduce on react-native 0.64.2 Not sure if the "requires node v15.xx" is strict for this issue, as I'm using node 14.17.6, perhaps that is a difference |
thank you so much you were right the problem was the Nodejs v16 I migrated to the LTS 14 and I have no problems anymore :) |
Hey, have the same issue in Node 14 ❌ |
I can confirm this is an Android specific issue. On iOS, the refresh is OK. Unfortunately, this lead to many hours of wasted work to reload the whole app to test a simple change on Android :( |
Something more subtle is going on I think. I just tested fast refresh on Android and it worked for me just now. Dependencies are largely what you get stock from luna template https://github.com/plaut-ro/luna - if you try a `npx react-native init FastRefreshNativeAndWeb template=plaut-ro/luna you should successfully fast refresh on all three platforms This was using node v14.18.1 if that matters, Android API30 emulator
|
That's great, but how would this help us with existing projects fix this issue? |
It does not help you directly, but what it shows you is that it is possible. What that usually means to me, when react-native troubleshooting, is that I start looking for project differences between projects to isolate the issue (and I posted a project init template: so it's easy to crank out a project for comparison), I stop hoping something magical will happen on a react-native issue. Stated differently: It might help you focus your troubleshooting effort where it is likely to be more effective. Frequently just knowing where the issue is (my project? react-native? some native library?) is the vital thing to know in order to then really solve the thing. That was my goal. Hopefully it was helpful. |
I am having similar problems. I'm on the latest RN 0.66.2 => the Metro Bundler is not able to dynamically perform Fast Refresh bundle to the iOS simulator and Android emulator when started in MacOS default terminal in a normal way. NOT WORKING
WORKING
In any case, the easiest workaround for me is just to keep an iTerm2 window running Metro Bundler all the time for the root project I am on. |
Oh that is subtle! More subtle then I was thinking. As test results, I can say I always run So there is something more subtle even going on, about the default terminal, somehow. Very odd but perhaps closer to results |
I am experiencing a similar problem. All methods have already been tried. Cleaned gradle, metro-cache, watchman, npm-cache. Reinstalled npm dependencies. I think I got this bug after I wanted to make hermes debugger for flipper work by running the
|
This will likely result in no change, however you may like |
This resolve my issue
|
A few days later I found out what caused it. I am using mobx 6 on a project and the documentation states what needs to be added to
As soon as I remove the connection of this plugin, everything starts working normally. At the moment I don't understand how this affects metro and how I can still use the specified plugin. I tried to make various configurations. it is also worth paying attention to this comment |
Update: tl;dr I fixed this by updating I previously tried updating but it didn't work, I then noticed I had a damn yarn resolution overriding the package (because of a CVS vulnerabilities in one of the nested libraries). Removing the resolution and updating the cli fixed it for me. Probably not what's affecting the rest of you but maybe it serves as a reminder to check your yarn resolutions. |
0.67 also have this problem on IOS. I created a fresh new project with react-native init command found 0.67.1 working fine with fast fresh in this project. Fast fresh only not working from the project which upgrade from 0.62 to 0.67.1. I guess some configuration in my project might break the fast fresh. But I don't know where is it. |
I had the same issue on Android after upgrading |
having this issue on react native 0.66.4 |
I may be wrong, but I don't think - for reporting / tracking react-native issues - there is any value at all in reporting status of an issue against old releases. Testing / reproducing against whatever the current stable release at the time is, has value. |
I've had this issue for so months now. The solutions on this thread is kinda ridiculous. Why so many solutions for a single problem? NO ONE seems to know what causes it, or why the solution fixes it. Insane. Looks like fast refresh is affected by multiple issues. Unfortunately, NO ONE KNOWS anything. |
@russeg I look forward to your detailed analysis so that we may all finally know something |
Updating to RN 0.68.0 fixed the issue for me, while using |
@mikehardy Why, I'm not the RN expert here. You seem to be, you should know right? I mean, you don't ask a medical intern to diagnose an issue and try to solve it by themselves by trial and error, when the resident physician is there to help. If the resident don't know, they get help from the attending physican. I hope you get my point. People where don't know, doing it by trial and error, suggesting solutions that might not really work. While the resident RN experts seem to not know too, and should raise this issue to the people further up who SHOULD know. But If this is how things work here (ie let the community figure it out by trial and error, hoping something will fix it) then fine i guess 😂😂 |
The community generally is going to have to figure it out by trial and error when there is no reproduction case proposed for current versions. That's where it's at if I'm not mistaken. I can't reproduce it |
In case this might help anyone: Samsung DeX! Samsung DeX runs a daemon on localhost:8081 which interferes with Metro. Stopping the daemon from the system tray solved all issues. |
I can't believe such a stupid-simple solution was my problem, thanks @jgolden 😅 |
This worked for me in react-native 0.69.0 |
Although it's really weird, I have to discuss that, things work after I |
I faced this issue yesterday. Took some time to find out that it was because of the swap file that gets created on edit. Disabling the swap file solved the problem for me. Unsure if it's relevant. |
|
Thanks alot. This works for me |
this works, but why, what's the interaction between watchman, swap files and fast refresh? these things seem completely unrelated to me |
Lost about 4 hours, digging in old project, both android/ios hot reload weren't working, it was refreshing but without updates. The problem was:
Only God knows why previous developer was doing like this. But passing component inside like this was breaking hot-reload. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Description
Fast refresh is not working in React Native 0.64.2. I have created the most barebones out of the box setup I could.
When I have the app running and I save a file, I expect to see the changes refreshed and visible in the app.
What is actually happening is that I need to stop and restart Metro to see the changes I have made.
I followed the environment setup instructions - opting to create a brand new project following the React Native CLI Quickstart path.
I also ensured that I do not have the react-native cli tool installed globally. This project is using the latest stable version of React Native (0.64.2).
React Native version:
Running
npx react-native info
yields the following:Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
You will need:
nvm use
to switch to the version of node that we need.yarn
pod install --project-directory=ios
yarn start
Expected Results
When I edit some text in
App.js
, I would expect to see the changes appear in the running instance of the app.Link to example repository
I have created a simple example app to demonstrate the issue => https://github.com/matfin/rn-fastrefresh-bug
The text was updated successfully, but these errors were encountered: