React-Native 開發的項目,Android 方面沒有任何問題,IOS 就是沒法跑起來,報錯信息以下:node
mac 10.14.4 xcode 10.2.1react
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening reactNative.xcodeproj 複製代碼
rm -rf node_modules && yarn cache clean
複製代碼
yarn install
複製代碼
rm -rf ~/.rncache
複製代碼
直接運行下載腳本,若直接下載完成,後面的步驟就不用看了,直接運行項目 react-native run-ios
便可ios
node_modules/react-native/scripts/ios-install-third-party.sh
複製代碼
國內下載是至關的慢,這時候就要合理使用下載工具了。我使用的是 proxy-down,開源下載工具,能夠配置代理。git
查看要下載的文件github
cat node_modules/react-native/scripts/ios-install-third-party.sh
複製代碼
輸出以下react-native
#!/bin/bash # 多餘的東西不顯示 fetch_and_unpack glog-0.3.5.tar.gz https://github.com/google/glog/archive/v0.3.5.tar.gz 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc "\"$SCRIPTDIR/ios-configure-glog.sh\"" fetch_and_unpack double-conversion-1.1.6.tar.gz https://github.com/google/double-conversion/archive/v1.1.6.tar.gz 1c7d88afde3aaeb97bb652776c627b49e132e8e0 fetch_and_unpack boost_1_63_0.tar.gz https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz c3f57e1d22a995e608983effbb752b54b6eab741 fetch_and_unpack folly-2018.10.22.00.tar.gz https://github.com/facebook/folly/archive/v2018.10.22.00.tar.gz f70a75bfeb394363d2049a846bba118ffb3b368a 複製代碼
四個下載連接是關鍵,使用工具下載這四個文件。下載連接與 React-Native 版本緊密關聯,請仔細查看文件版本。xcode
下載完成後,新建文件夾 .rncache,將下載的四個文件移入到目錄下緩存
mkdir ~/.rncache
複製代碼
再次運行安裝腳本,由於使用本地下載文件,全部運行起來很快。bash
node_modules/react-native/scripts/ios-install-third-party.sh
複製代碼
運行項目就能夠跑起來了,首次啓動會有點慢,耐心等會就行。markdown
react-native run-ios
複製代碼