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

2019-02-09 09:49发布

问题:

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

回答1:

try it

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

Run the configure script: ./configure 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


回答2:

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:

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



回答4:

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.



回答5:

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