Javascript 未找到React Native Config.h

Javascript 未找到React Native Config.h,javascript,ios,objective-c,xcode,react-native,Javascript,Ios,Objective C,Xcode,React Native,我是React本地开发人员的初学者 创建新项目后,打开它 xcode显示错误config.h在mutex.h文件中找不到该文件。我也在谷歌搜索,并尝试可能的解决方案,但仍然显示相同的错误 我已经按照命令做了 1 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install watchman npm install

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

创建新项目后,打开它

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

我已经按照命令做了

1

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install watchman
npm install -g react-native-cli
react-native init projectName
cd projectName
react-native start
react-native run-ios
2

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install watchman
npm install -g react-native-cli
react-native init projectName
cd projectName
react-native start
react-native run-ios
3

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install watchman
npm install -g react-native-cli
react-native init projectName
cd projectName
react-native start
react-native run-ios
4

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install watchman
npm install -g react-native-cli
react-native init projectName
cd projectName
react-native start
react-native run-ios
5

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install watchman
npm install -g react-native-cli
react-native init projectName
cd projectName
react-native start
react-native run-ios
6

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install watchman
npm install -g react-native-cli
react-native init projectName
cd projectName
react-native start
react-native run-ios
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个错误

软件版本列表
自制1.6.8
react native cli:2.0.1
反应本机:0.55
看守员4.9.0
npm 6.1.0

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

$ rm -rf node_modules/
在终端中,导航到第三方/glog配置glog文件

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

在项目目录中运行以下命令。帮助我解决我的config.h未找到问题

  • cd节点_模块/react本机/第三方/glog-0.3.4/
  • /配置
  • 制造
  • 安装
  • cd../../../
  • 反应本机运行ios

  • 我通过以下步骤将其修复:

  • 关闭Xcode
  • cd/node\u模块/react本机/第三方/glog-0.3.4
  • 运行
    /configure
  • 运行
    make
  • 运行
    makeinstall
  • 打开Xcode并尝试构建项目

  • 希望这能解决问题

    我的问题是使用react时出现的-native@0.53.0,我想它在新的Xcode版本中有问题

    1-更改
    package.json中的react本机版本

    "react-native": "0.53.0",
    

    2-删除
    node\u模块
    文件夹

    $ rm -rf node_modules/
    
    3-重新安装模块:

    $ yarn install
    
    yarn cache clean
    rm -rf node_modules
    yarn install
    
    解决方案:

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


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

    我将为这个问题添加另一个答案,因为这周它让我抓狂

    $ cd ./node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party && cd $(ls | grep 'glog' | awk '{print $1}') && ./configure
    
    手动配置glog所需的步骤(比如samridhgupta,他接受的答案或我在上面写的命令)对我来说很有效,但这只是我第一次构建项目时。在每一次构建中,我都必须执行相同的过程,因此我需要一个更稳定的解决方案

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

    如果有人面临同样的问题,您需要删除或注释下面的行(ios安装第三方可以在/node_modules/react native/scripts中找到)


    什么对我有用:

    $ yarn install
    
    yarn cache clean
    rm -rf node_modules
    yarn install
    

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

    将此
    修复
    脚本添加到
    包中。json

    "scripts": {
        "fix": "cd node_modules/react-native/third-party/glog-0.3.4 && ./configure && make && make install"
      },
    

    然后运行
    warn fix
    npm run fix
    ,然后在make命令显示后尝试构建项目

    ,如下make:**没有规则使目标“安装”。Stop.issue已解决使用较低版本的react-native init删除“node_modules”,然后运行“thread install”命令,然后在您的ans第2步和第3步之后,使用react-native 0.56正确运行它version@BhaumikSurani谢谢你的见解。。。在某些情况下,第4-5步是必需的……我没有时间去真正了解为什么在某些情况下需要它……但是上面的步骤是一种让它工作的解决方案。我是iOS新手,什么是
    make
    make
    是一种构建工具,通常与C/C++项目一起使用。它的功能由目录中的
    Makefile
    配置。步骤3-5是此处构建和安装的步骤。谢谢