React native is stuck at old version app

前端 未结 8 1385
慢半拍i
慢半拍i 2020-12-28 21:50

When I run react-native run-android it only installs the old version of the app in simulator and changes are not shown.

Any suggestion is appreciated.

8条回答
  •  暖寄归人
    2020-12-28 22:16

    Have you tried react-native start --reset-cache ?

    Or maybe you can try to reset the MAX_WAIT_TIME (I found it here). 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);
        });
      });
    }
    

    May it help you! :D

提交回复
热议问题