找不到React Native Config.h

Bha*_*ani 25 javascript xcode objective-c ios react-native

我是React本地开发人员的初学者.

创建新项目后,打开它.

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

我完成了以下命令

1

__CODE__/ usr/bin/ruby​​ -e"$(curl -fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"`

2

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

3

brew install watchman
Run Code Online (Sandbox Code Playgroud)

4

npm install -g react-native-cli
Run Code Online (Sandbox Code Playgroud)


react-native init projectName
Run Code Online (Sandbox Code Playgroud)

6

cd projectName
react-native start
Run Code Online (Sandbox Code Playgroud)

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个错误.

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

我也尝试这个解决方案,但仍然是错误的

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

react-native run-ios
Run Code Online (Sandbox Code Playgroud)

sam*_*pta 71

我通过以下步骤修复了它:

  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并尝试构建项目.

希望这能解决问题

  • 我删除"node_modules"然后运行"yarn install"命令然后在你的第二和第三步运行它正确使用react-native 0.56版本 (2认同)
  • @BhaumikSurani感谢您的见解...在某些情况下需要第4步 - 第5步....没有时间真正了解为什么需要在某些情况下...但上述步骤是一种解决方案,以使其工作 (2认同)
  • `make`是一个构建工具,通常与C/C++项目一起使用.http://www.gnu.org/software/make/它的作用是由目录中的`Makefile`配置的.步骤3-5是构建和安装https://github.com/google/glog的步骤 (2认同)

She*_*mir 7

2023解决方案更新

看起来它变成了:
#import“RNCConfig.h”

只需删除“ReactNativeConfig.h”并将其替换为“RNCConfig.h”