How to solve “config.h file not found”? when runni

2019-02-09 10:02发布

Getting error "Config.h file not found, lexical or preprocessor error."

I am running app in the device from the xcode project.

I have google and found many solutions but haven't worked, I tried this

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

And when I try to run in the iOS simulator getting this error

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

Tried to follow the above url but didn't work.

Please let me know how to solve the issue. Thanks

5条回答
做自己的国王
2楼-- · 2019-02-09 10:24

I faced the same issue and it's fixed by these commands:-

yarn

rm -rf node_modules/
yarn clean cache 
yarn install 

npm

rm -rf node_modules/
npm cache clean  
npm i 
查看更多
迷人小祖宗
3楼-- · 2019-02-09 10:31

Just go on the config.h file, click on the right panel and add the file to the app target by checking the right case. Clean and compile again.

查看更多
老娘就宠你
4楼-- · 2019-02-09 10:34

Remove the third-party folder in your node_modules/react-native folder.

查看更多
劫难
5楼-- · 2019-02-09 10:40

For me:

# rm -rf  node_modules

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

# npm install

Xcode Clean

Xcode Run

If that doesn't work,

In the Terminal, navigate to the react-native/third-party/glog folder inside node_modules

(for me, this was cd node_modules/react-native/third-party/glog-0.3.4)

Once actively in this folder,

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

Glog is configured and the required config.h header file is created for Xcode to find

查看更多
Emotional °昔
6楼-- · 2019-02-09 10:46

try it

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

enter image description here Run the configure script: ./configure enter image description here Open Xcode and try to run your app.

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
查看更多
登录 后发表回答