簡體   English   中英

如何解決“找不到config.h文件”? 從設備上的本機反應運行應用程序時?

[英]How to solve “config.h file not found”? when running app from the react native on the device?

出現錯誤“找不到 Config.h 文件,詞法或預處理器錯誤。”

我正在從 xcode 項目在設備中運行應用程序。

我有谷歌並找到了很多解決方案但沒有奏效,我試過這個

https://github.com/facebook/react-native/issues/14382

當我嘗試在 iOS 模擬器中運行時出現此錯誤

https://github.com/facebook/react-native/issues/10401

試圖按照上面的網址,但沒有奏效。

請讓我知道如何解決這個問題。 謝謝

試試看

Open Terminal, go to your project’s root folder and do:
cd node_modules/react-native/third-party/glog-0.3.4/

在此處輸入圖片說明 運行配置腳本:./configure 在此處輸入圖片說明 打開 Xcode 並嘗試運行您的應用程序。

Xcode 10

"react-native": "0.57.5"

cd ./node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party && cd $(ls | grep 'glog' | awk '{print $1}') && ./configure

我遇到了同樣的問題,它已通過以下命令修復:-

紗線

rm -rf node_modules/
yarn cache clean
yarn install 

新產品經理

rm -rf node_modules/
npm cache clean  
npm i 

對我來說:

# rm -rf  node_modules

# npm cache verify  (Because I'm using npm version 5.0.3)

# npm install

Xcode Clean

Xcode Run

如果這不起作用,

在終端,導航到react-native/third-party/glog foldernode_modules

(對我來說,這是cd node_modules/react-native/third-party/glog-0.3.4

一旦活躍在這個文件夾中,

#run ../../scripts/ios-configure-glog.sh

配置glog並創建所需的config.h頭文件,供Xcode查找

只需轉到 config.h 文件,單擊右側面板並通過檢查正確的大小寫將文件添加到應用程序目標。 清理並再次編譯。

刪除 node_modules/react-native 文件夾中的第三方文件夾。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM