xcode 未找到 React Native Config.h

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50836558/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:41:02  来源:igfitidea点击:

React Native Config.h not found

javascriptiosobjective-cxcodereact-native

提问by Bhaumik Surani

I'm beginner of React native developer.

我是 React 本机开发人员的初学者。

After create new project then open it.

创建新项目后打开它。

xcode is display error config.hfile not found in mutex.hfile. I'm also search in google and try possible solution but still display same error.

xcode 是显示错误config.h文件未在mutex.h文件中找到。我也在谷歌搜索并尝试可能的解决方案,但仍然显示相同的错误。

I'm done Following Commands

我完成了以下命令

1

1

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2

2

brew install watchman

3

3

npm install -g react-native-cli

4

4

react-native init projectName

5

5

cd projectName
react-native start

6

6

react-native run-ios

Error in CMD
./Desktop/Demo React Native/projectName/node_modules/react-native/React/../third-party/glog-0.3.4/src/base/mutex.h:105:10: fatal error: 'config.h' file not found

include "config.h" // to figure out pthreads support

1 error generated.

CMD 错误
./Desktop/Demo React Native/projectName/node_modules/react-native/React/../third-party/glog-0.3.4/src/base/mutex.h:105:10: 致命错误:'未找到 config.h' 文件

包含 "config.h" // 找出 pthreads 支持

产生了 1 个错误。

Software Version List
Homebrew 1.6.8
react-native-cli: 2.0.1
react-native: 0.55
watchman 4.9.0
npm 6.1.0

软件版本列表
Homebrew 1.6.8
react-native-cli: 2.0.1
react-native: 0.55
watchman 4.9.0
npm 6.1.0

I'm also try this soluation but still error

我也在尝试这种解决方案,但仍然出错

In the Terminal, navigate to the third-party/glogand config glogfile

在终端中,导航到第三方/glog配置 glog文件

cd node_modules/react-native/third-party/glog-0.3.4
./../scripts/ios-configure-glog.sh

回答by samridhgupta

I got it fixed by following this steps:

我按照以下步骤修复了它:

  1. Close Xcode.
  2. cd <Project-Folder>/node_modules/react-native/third-party/glog-0.3.4
  3. Run ./configure
  4. Run make
  5. Run make install
  6. Open Xcodeand try building the Project.
  1. 关闭Xcode
  2. cd <Project-Folder>/node_modules/react-native/third-party/glog-0.3.4
  3. ./configure
  4. make
  5. make install
  6. 打开Xcode并尝试构建项目。

Hope this solves the issue

希望这能解决问题

回答by David Manpearl

Solution:

解决方案:

yarn upgrade log

Upgrade to v1.6.0 successful. iOS build successful.

升级到 v1.6.0 成功。iOS 构建成功。

Note: Rebuilding glog did did not work for me. Build failed.

注意:重建 glog 对我不起作用。构建失败。

回答by dentemm

I will add another answer to this issue since it was driving me crazy this week...

我将为这个问题添加另一个答案,因为这周让我发疯......

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

The steps needed to manually configure glog (like samridhgupta his accepted answer or the command I wrote here just above) worked for me, but only the first time I build the project. On every single build I had to go to the same process so I needed a more stable solution.

手动配置 glog 所需的步骤(如 samridhgupta 他接受的答案或我在上面写的命令)对我有用,但只在我第一次构建项目时。在每次构建时,我都必须执行相同的过程,因此我需要一个更稳定的解决方案。

I appears Xcode is executing ios-install-third-party.shon every build, which means it will also execute ios-configure-glog.shevery single time. So my solution is to just build a single time, and then comment out the glog install step in the ios-install-third-party script.

我似乎Xcode在每次构建时都在执行ios-install-third-party.sh,这意味着它每次都会执行ios-configure-glog.sh。所以我的解决方案是只构建一次,然后在ios-install-第三方脚本中注释掉glog安装步骤。

If anyone is facing this same issue, it is the line below you need to remove or comment out (ios-install-third-party can be found in /node_modules/react-native/scripts).

如果有人遇到同样的问题,您需要删除或注释掉下面的行(ios-install-third-party 可以在 /node_modules/react-native/scripts 中找到)。

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\""

回答by Himanshu G

Run following commands in project directory.Helped me resolve my config.h not found issue

在项目目录中运行以下命令。帮助我解决了我的 config.h not found 问题

  1. cd node_modules/react-native/third-party/glog-0.3.4/
  2. ./configure
  3. make
  4. make install
  5. cd ../../../..
  6. react-native run-ios
  1. cd node_modules/react-native/第三方/glog-0.3.4/
  2. 。/配置
  3. 制作
  4. 进行安装
  5. cd ../../../..
  6. react-native run-ios

回答by Made in Moon

My problem was comming from using [email protected], which I suppose has trouble with new Xcode version.

我的问题来自于使用 [email protected],我想新 Xcode 版本有问题。

1 - Change react-native version in package.json

1 - 更改 react-native 版本 package.json

"react-native": "0.53.0",

to

"react-native": "0.56.0",

2 - Remove node_modulesfolder

2 - 删除node_modules文件夹

$ rm -rf node_modules/

3 - Reinstall modules:

3 - 重新安装模块:

$ yarn install

回答by Mohamed Ben Hartouz

What worked for me:

什么对我有用:

yarn cache clean
rm -rf node_modules
yarn install

回答by Bhavik Modi

If any of these solution does not work, please check your project path. Project path - directory names should not contain any space in its name or you can create project on Desktop or in Documents directory.

如果这些解决方案中的任何一个不起作用,请检查您的项目路径。项目路径 - 目录名称中不应包含任何空格,或者您可以在桌面或文档目录中创建项目。