React-native: React Packager not reloading

Created on 14 Jul 2016  路  13Comments  路  Source: facebook/react-native

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?

Locked

Most helpful comment

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.

All 13 comments

@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.

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

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 .
Try watchman watch-del-all and restart packager.

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.

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 )

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

@yooneskh you found any solution?

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.

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

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

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

+1 , I also had the same problem.

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

Was this page helpful?
0 / 5 - 0 ratings