回答我自己的问题。这篇文章帮助了我。
在这个文件里面 \node_modules\react-native\node_modules\node-haste\lib\FileWatcher\ index.js
- 我不得不增加
MAX_WAIT_TIME
(我的我从 120000 变为 360000)。
- 也不得不改变
这
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);
});
});
}
进入
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);
});
});
}
现在,在此更改之后,我所做的任何代码更改,我什至不必按 R 两次,它会自动更改。我希望这可以帮助像我这样的菜鸟。谢谢你。