React-native: Reloading App not updating for the latest modified code

Created on 16 Sep 2018  路  15Comments  路  Source: facebook/react-native

Environment

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
      Memory: 1.46 GB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.8.0 - /usr/local/bin/node
      Yarn: yarn install v0.23.3
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 22.06s. - ~/.npm-packages/bin/yarn
      npm: 5.6.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.0, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3
        API Levels: 19, 20, 22, 23, 24, 25, 26, 27
    IDEs:
      Android Studio: 3.1 AI-173.4720617
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.0 => 16.5.0 
      react-native: 0.57.0 => 0.57.0 
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native-rename: 2.2.2

Description

Hi I create a new app using RN v0.57.0, the issue when I try to hot reloading or live reload (or normal reload) it didn't update with the latest code I edit. Both iOS and Android are not updating to the latest changes I did and the only solution I can do for now was to restart my macbook pro. Do you know any links or documentation on how to fix this issue? I also tried the solutions suggested on this code https://github.com/facebook/react-native/issues/9977

thanks,

Bug Locked

Most helpful comment

deleting .git/index.lock worked for me.

All 15 comments

I tried also several solution by reinstalling watchman and creating a new app but it looks like the metro bundler and watchman is not updating the status when I reload it. I also remove several *.lock files but no luck

You can shake the device or press R and enable hot reloading. Hot Reloading does not appear to be enabled by default.

I have the same problem.
npm start - --reset-cache
Even the first one is refreshed.
too difficult.
Can you suggest a solution?

In XCode or Android Studio @khjde1207?

@telkandrew in Xcode, i have same problem,
npm start --- reset-cach (didn't work )

Closing in favour of https://github.com/facebook/react-native/issues/18899, since they are related.

deleting .git/index.lock worked for me.

@neonsec where is .git/index.lock located?

@neonsec Cool, it do works !

and I find a reason why this happened

https://github.com/facebook/watchman/blob/4b98623e8fde17588f27494f3ae8f084b9b227d3/QueryableView.cpp#L48

it looks like when a .git/index.lock or a .hg/wlock file exist, watchman will do nothing

i dont have that file and I am trying to run the jitsi meet in react native. Can it be the issue of watchman as i dont have watchman installed?

it is working for me thanks

Its a hidden file. Go to your main project directory in your terminal and run this command "rm -rf .git/index.lock"

For me the problem was with the AndroidX, basically some time you need to migrate to AndroidX due to the react-native old versions

just open your project in the Android Studio

Refactor -> Migrate to Android X ... and flow the instructions

and don't avoid to make backup when it will be promoted for save side

@neonsec It works for me. Thanks a lot.
You save my day :D

React Native 0.61 includes a complete reimplementation of this mechanism called Fast Refresh. It's not out yet as stable, but you can already try React Native 0.61 RC 3.

I'll lock this because the implementation is completely different. So if there are still problems after you upgrade to 0.61, please file a new issue with full reproducing instructions (and preferably, a project). Thanks!

Was this page helpful?
0 / 5 - 0 ratings