從GitHub上down下來(lái)的React Native項(xiàng)目在Xcode中不能直接運(yùn)行,會(huì)報(bào):
RCTRootView.h file
not found的錯(cuò)誤鄙漏,并且左面一大堆紅旗吁。
解決辦法:
- cd到這個(gè)項(xiàng)目中庆猫,執(zhí)行
npm install react-native
. - 此項(xiàng)目中還有其他依賴(lài),執(zhí)行
npm install
嫁佳,即可添加所有依賴(lài)。
執(zhí)行完兩命令重新打開(kāi)項(xiàng)目附鸽,效果如下:
此時(shí)脱拼,運(yùn)行項(xiàng)目,倘若模擬器和終端分別報(bào)下面的錯(cuò)誤:
** ERROR ** Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE
at exports._errnoException (util.js:1036:11)
at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11)
安裝watchman:
- 終端鍵入
brew install watchman
重新打開(kāi)項(xiàng)目運(yùn)行坷备,則: