我有同样的问题,并找到几个解决方案。以下是为我工作:
为了使生活与> 0.29反应母语版本
- 重装转到文件:
yourProjectFolder//node_modules/react-native/local-cli/server/server.js
- 赞许线(62) :process.exit(11) - > //process.exit(11)
关于第2点:我不知道从什么时候开始2.1的解决方案。是需要的,但我认为〜反应本机v.33。如果有人确切地知道,请纠正这一点你只要看看是否在2.或2.1处找到了index.js。路径。
2.1(的旧路径阵营本地FileWatcher index.js)转到文件:yourProjectFolder//node_modules/react-native/node_modules\node-haste\lib\FileWatcher\index.js"
2.2(较新的阵营,本土FileWatcher index.js路径)转到文件: yourProjectFolder\node_modules\react-native\packager\react-packager\src\node-haste\FileWatcher\index.js
STEP 1为2.1 + 2.2:
Increase
在index.js
文件的顶部:MAX_WAIT_TIME=120000
>MAX_WAIT_TIME=360000
- 更改
function (_createWatcher)
到:
STEP 2为2.1(旧版路径index.js)
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);
});
});
}
STEP 2 2.2(index.js的较新的路径)
_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);
});
});
}
该解决方案为我工作。希望如果我错了,我可以帮助你并纠正我。
谢谢你的回答。我做了你在2.1中写的东西,但不幸在'myProjectFolder/node_modules/react-native/local-cli/server/server.js'中找不到'process.exit(1)'这一行。我正在使用'react-native version 0.35.0' – krzyhub
星期二我回来了,我可以看看它。 –
你很亲切。感谢您的倡议。直到这个时候,我会努力克服这个问题。如果我能找到解决方案,我会在这里分享。 – krzyhub