1、在github 上面 git clone 一個RN 項目代碼,npm install (yarn)后,准備運行iOS工程,發現'config.h' file not found ,惡心!!!
百度發現:這個是常見錯誤,只需要在項目根目錄下(里面包含node_modules文件夾)運行以下命令(下面的兩行同時復制,終端運行)即可解決:
cd node_modules/react-native/third-party/glog-0.3.4
../../scripts/ios-configure-glog.sh
注意:具體的版本號要根據報錯的提示來定
2、20190225 發現 'glog/logging.h' file not found 的問題(RN 版本 0.58),解決方式(參照上面的,復制下面2行,終端執行):
cd node_modules/react-native/third-party/glog-0.3.5
../../scripts/ios-configure-glog.sh
3、討厭的錯誤,如下:
configure: error: C compiler cannot create executables
See `config.log' for more details
這個很是令人討厭!!!出現的原因可能也不一致,下面列舉不同時間出現的問題,解決方案和猜想。
20181123運行正常的項目,突然間就出現了config.h' file not found。按照上面的解決方式解決后,運行正常。第二天升級了mac 系統到macOS Mojave (版本10.14);Xcode 更新到Version 10.1 (10B61) 后,又出現了
configure: error: C compiler cannot create executables
See `config.log' for more details
當時百度上說是要安裝 GCC 。就用:brew install gcc 安裝了下最新版本的gcc 。但是安裝完了之后,依然報如下錯誤(郁悶):
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
configure: error: C compiler cannot create executables
See `config.log' for more details
最后有效解決方案:
打開xcode...,偏好設置 ,如下圖,command line tools 要選中一個 (這個可能是當時安裝了兩個版本的XCODE,導致沒有選擇一個)。
20190313 發現glog/logging.h' file not found 問題后,按照上面20190225問題解決,卻出現了 關鍵詞如下的錯誤:
configure: error: C compiler cannot create executables
See `config.log' for more details
過程描述:前幾天還是正常運行的,只是換了一個模擬器的機子,就出現了glog/logging.h' file not found ,按照上面的方式執行腳本,但是執行的過程中,出現了 configure: error: C compiler cannot create executables 問題。
解決方法及猜想: 1、glog/logging.h' file not found出現可能跟換模擬器有關(只是猜想)2、configure: error: C compiler cannot create executables 的出現可能跟剛才執行的另外一個RN項目有關,終端在開着另外一個RN項目的本地服務。解決方式:將終端關閉,再次運行項目,一切OK 。
20190820遇到問題:給其他團隊新建一個基於RN 0.57.5版本的工程,運行IOS 項目,報一堆錯誤,解決問題記錄如下:
1)Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure
解決:類似Command PhaseScriptExecution failed with a nonzero exit code 等錯誤,最簡單的解決方法如下:
xcode->file->Workspace Settings->Build System 選擇Legacy Build System 使用舊的編譯系統即可。
如果沒有使用cocoapods 進行管理的話,
xcode->file->project Settings->Build System 選擇Legacy Build System 使用舊的編譯系統即可。
這樣一設置,項目報錯去掉了一半了。
2)/node_modules/react-native/third-party/glog-0.3.5/src/base/mutex.h:105:10: 'config.h' file not found
3) configure:-1: C compiler cannot create executables
解決方法:只需要在項目根目錄下(里面包含node_modules文件夾)運行以下命令(下面的兩行同時復制,終端運行)即可解決:
cd node_modules/react-native/third-party/glog-0.3.5
../../scripts/ios-configure-glog.sh