react-native icon indicating copy to clipboard operation
react-native copied to clipboard

React Packager not reloading

Open yooneskh opened this issue 10 years ago • 13 comments

I am developing on windows (8.1) and am using genymotion (2.7.2 and Nexus 5 device with android 4) for simulator.

The problem is that i cannot get the reload to work. i have done the adb reverse tcp:8081 tcp:8081 .

The only way to get the new files to be seen is to do another react-native run-android .

Any help?

yooneskh avatar Jul 14 '16 16:07 yooneskh

@yooneskh

Android: ctrl+m inside AVD
Click Reload

Read specs: http://facebook.github.io/react-native/releases/0.29/docs/debugging.html#reloading-javascript

This is not a issue with react-native, so please go to Stackoverflow or read docs :) Issue can be closed.

st0ffern avatar Jul 14 '16 17:07 st0ffern

@stoffern i already know this. I go to genymotion, open the so called menu, hit the reload and nothing happens.

yooneskh avatar Jul 14 '16 17:07 yooneskh

To clarify even more, these actions complete successfully

  • i run the app in the emulator
  • open the menu
  • select "enable hot reload"
  • React Packager shows some messages about transforming some things and such
  • the app fetches js bundle, flashes and things go back to where they were

but my changed files are not there.

since the app and React Packager seem to successfully talk with each other, i guess React Packager just does not see the changes.

yooneskh avatar Jul 14 '16 19:07 yooneskh

@yooneskh . Try watchman watch-del-all and restart packager.

malaman avatar Jul 15 '16 15:07 malaman

Having same issues here. Worked with react-native 0.23 & 0.27. Hot reloading always worked as expected. Since my upgrade on 0.29.1 (stable) the hotreloading doesn't reload the code.

StellwagJo avatar Jul 18 '16 14:07 StellwagJo

I have same issue on react native 0.28 and windows 10

upd: increasing constant MAX_WAIT_TIME in file "\node_modules\node-haste\lib\FileWatcher\index.js" helped me. (from this recipe https://github.com/facebook/react-native/issues/7257#issuecomment-215344719 )

psrustik avatar Jul 19 '16 18:07 psrustik

exactly same issue on Windows 7 Work fine on 0.28 but problem in 0.30 and 31, 32

@yooneskh you found any solution?

vzhen avatar Aug 28 '16 04:08 vzhen

same issue on android device with react-native 0.32.

finally, i found method to solve this problem.

in file "react-native\packager\react-packager\src\node-haste\FileWatcher\index.js" you can increase "MAX_WAIT_TIME" variable. such: 360000.

and change function "_createWatcher"

to

_createWatcher(rootConfig) {
    const watcher = new WatcherClass(rootConfig.dir, {
      glob: rootConfig.globs,
      dot: false,
    });

    return new Promise((resolve, reject) => {
      const rejectTimeout = setTimeout(
        () => reject(new Error([
            'Watcher took too long to load',
            'Try running `watchman version` from your terminal',
            'https://facebook.github.io/watchman/docs/troubleshooting.html',
          ].join('\n'))),
        MAX_WAIT_TIME
      );

      watcher.once('ready', () => {
        clearTimeout(rejectTimeout);
        resolve(watcher);
      });
    });
  }

that's all and work for me.

togayther avatar Sep 03 '16 04:09 togayther

I also had the same problem. Working now. Thanks guys! react-native: 0.32.0 react-native-cli: 1.0.0 OS: Windows 10

sebahattint avatar Sep 07 '16 15:09 sebahattint

Had the same issue, @togayther's solution fixed it. Thanks :) react-native: 0.30.0 OS: Windows 10

Brokray avatar Sep 19 '16 10:09 Brokray

I found the directory is wrong, according to the previous method, version 0.34 is supposed to be in the directory, but after I changed or not, have not had any effect The question has bothered me for two days. I also had the same problem.For help Thanks guys!
react native 0.33/0.34 OS:Windows 10

TrustDec avatar Oct 08 '16 10:10 TrustDec

+1 , I also had the same problem.

Neungzad avatar Oct 11 '16 07:10 Neungzad

I still have this problem even with @togayther's fix. react-native-cli: 1.0.0 react-native: 0.36.0 macOS 10.12.1

aljux avatar Nov 03 '16 08:11 aljux