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

[Android][0.24.1][Windows] packager not update when change js file content

Open InnerPeace080 opened this issue 10 years ago • 26 comments

after i update react native to 0.24.1, I modify javascript code and save but packager server not detect this change. So reload js from my android have no effect.

anybody has some advance, thank very much.

InnerPeace080 avatar Apr 27 '16 11:04 InnerPeace080

Have you tried restarting you packager/emulator/computer? Maybe check this issue: https://github.com/facebook/react-native/issues/306. Look at watchman, auto-saving.

radko93 avatar Apr 27 '16 22:04 radko93

restart packager , computer have no effect. i have no idea with this

InnerPeace080 avatar Apr 28 '16 02:04 InnerPeace080

+1, I got the same problem, live load and hot load both not working. The js file only transformed once when I start the packager. It also toke so long time to finish. here is the log :

[11:52:39] request:/index.android.bundle?platform=android&dev=true&hot=t rue&minify=false [11:52:39] find dependencies [11:56:49] Crawling File System (261278ms) [11:56:49] Building in-memory fs for JavaScript [11:56:51] Building in-memory fs for JavaScript (1743ms) [11:56:51] Building in-memory fs for Assets [11:56:52] Building in-memory fs for Assets (1166ms) [11:56:52] Building Haste Map [11:56:53] Building (deprecated) Asset Map [11:56:53] Building (deprecated) Asset Map (307ms) [11:56:53] Building Haste Map (758ms) [11:56:53] Building Dependency Graph (264980ms) transformed 528/528 (100%) [11:56:59] find dependencies (260047ms) [11:56:59] request:/index.android.bundle?platform=android&dev=true&hot=t rue&minify=false (260291ms) [Hot Module Replacement] Client connected

taxusyew avatar Apr 28 '16 04:04 taxusyew

at last . I found problem.

problem still is timeout . but when timeout it not show message for us (still don't know why.).

to solve this problem.

in file "\node_modules\node-haste\lib\FileWatcher\index.js" you should increase "MAX_WAIT_TIME" variable (example : 360000) ;

and change function "_createWatcher" from

key: '_createWatcher',
    value: function _createWatcher(rootConfig) {
      var watcher = new WatcherClass(rootConfig.dir, {
        glob: rootConfig.globs,
        dot: false
      });

      return new Promise(function (resolve, reject) {
        var rejectTimeout = setTimeout(function () {
          return reject(new Error(timeoutMessage(WatcherClass)));
        }, MAX_WAIT_TIME);

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

to

key: '_createWatcher',
    value: function _createWatcher(rootConfig) {
      var watcher = new WatcherClass(rootConfig.dir, {
        glob: rootConfig.globs,
        dot: false
      });

      return new Promise(function (resolve, reject) {

        const rejectTimeout = setTimeout(function() {
          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', function () {
          clearTimeout(rejectTimeout);
          resolve(watcher);
        });
      });
    }

now . every thing run normal . :D

InnerPeace080 avatar Apr 28 '16 08:04 InnerPeace080

great solution InnerPeace080:+1:

tahaziadeh avatar May 27 '16 12:05 tahaziadeh

Thanks a lot, PeaceFromInside080 !!! ^_^

shtefanntz avatar Jul 10 '16 14:07 shtefanntz

How to deal with Windows Platform? "\node-haste\lib\FileWatcher\index.js" how can I get this file ?install watchman?

xiDaiDai avatar Jul 12 '16 07:07 xiDaiDai

finally got the file path :\node_modules\react-native\node_modules\node-haste

xiDaiDai avatar Jul 12 '16 07:07 xiDaiDai

thanks

micsay avatar Jul 12 '16 14:07 micsay

thanks, that's work.

togayther avatar Jul 23 '16 01:07 togayther

I was stuck with this one for hours. @InnerPeace080 your solution saved my life! Amazing! :)

nishil-tamboli avatar Sep 03 '16 09:09 nishil-tamboli

You saved my day. Your solution works perfect. Thank you so much !!!!

TranTungVGroup avatar Sep 10 '16 06:09 TranTungVGroup

For the benefit of future Googlers, MAX_WAIT_TIME is located here :

\node_modules\react-native\packager\react-packager\src\node-haste\FileWatcher\

saintograph avatar Sep 15 '16 03:09 saintograph

Thank you very much @InnerPeace080! I was stucked in this for hours!

cirojr avatar Sep 28 '16 14:09 cirojr

Thank you all From the bottom of Stavro's heart!

vicmpen avatar Sep 29 '16 10:09 vicmpen

thanks!

MoLow avatar Oct 11 '16 04:10 MoLow

update node.js to 6.x may works

nearchan avatar Oct 11 '16 08:10 nearchan

Thank you @InnerPeace080 . On my windows system file path was :node_modules\react-native\packager\react-packager\src\node-haste\Filewatcher.

ghost avatar Oct 19 '16 13:10 ghost

This not good. The code is now like this. Error come up when I do replace

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

return new Promise((resolve, reject) => {
  const rejectTimeout = setTimeout(
    () => reject(new Error(timeoutMessage(WatcherClass))),
    MAX_WAIT_TIME
  );

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

}`

neilhanekom avatar Oct 22 '16 08:10 neilhanekom

Niccee!!!! Thank You !!!!

lowdev avatar Oct 23 '16 19:10 lowdev