编译依赖于React Native0.46.4的React Native IOS工程时,出现错误“fatal error: 'React/RCTEventEmitter.h' file

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了编译依赖于React Native0.46.4的React Native IOS工程时,出现错误“fatal error: 'React/RCTEventEmitter.h' file相关的知识,希望对你有一定的参考价值。

我的环境:

WebStorm 2017.2
Build #WS-172.3317.70, built on July 14, 2017

JRE: 1.8.0_152-release-915-b5 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Mac OS X 10.12.6

Xcode8.3.3(8E3004b)

 

网上搜索,可以解决我的问题的网址:https://stackoverflow.com/questions/41663002/react-rctbridgemodule-h-file-not-found

搬运如下:

In my case this particular problem happened when I was trying to archive a 0.40+ react-native app for ios (solution was found here: https://github.com/facebook/react-native/issues/11721#issuecomment-270672904).

What happened was that xCode was trying to build the react-native libraries in parallel and was building libraries with implicit react dependencies before actually building the react library.

The solution in my case was to:

  1. Disable the parallel builds:

    • xCode menu -> Product -> Scheme -> Manage Shemes...
    • Double click on your application
    • Build tab -> clear the tick on Pallelize Build
  2. Add react as a project dependecy

    • xCode Project Navigator -> drag React.xcodeproj from Libraries to root tree
    • Build Phases Tab -> Target Dependencies -> + -> add React


以上是关于编译依赖于React Native0.46.4的React Native IOS工程时,出现错误“fatal error: 'React/RCTEventEmitter.h' file的主要内容,如果未能解决你的问题,请参考以下文章

node-sass是对React项目的开发还是生产依赖?

suse11 SP3上源码安装R过程

在 React 测试库中测试依赖于 Stateful Context Providers 链的 React 组件

React-Native - 使用依赖于 node.js 核心模块的 Javascript 模块

Switch 语句依赖于 React-Router Route

如何使用 React 钩子处理/链接依赖于另一个的同步副作用