React-native-code-push: React/RCTEventEmitter.h file not found

Created on 21 Apr 2019  路  16Comments  路  Source: microsoft/react-native-code-push

I followed the instructions to install this on iOS.
The react-native link and manual methods result in this error during build.

When using CocoaPods to install, pod install fails.

$ pod install
Ignoring unf_ext-0.0.7.4 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.4
Analyzing dependencies
Fetching podspec for `CodePush` from `../node_modules/react-native-code-push`
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
[!] CocoaPods could not find compatible versions for pod "React/Core":
  In snapshot (Podfile.lock):
    React/Core

  In Podfile:
    React/Core (from `../node_modules/react-native`)

None of your spec sources contain a spec satisfying the dependencies: `React/Core (from `../node_modules/react-native`), React/Core`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
iOS

Most helpful comment

Current workaround found, adding the missing lib manually to the CodePush Pods project :
Screen Shot 2019-05-06 at 21 08 45

All 16 comments

Hey @felixchan,
Thanks for reporting!

Could you clarify some points about your environment?

  • react-native-code-push version?
  • react-native version?
  • Does this reproduce on a debug build or release build?

Maybe you could provide us with some simple demo project so we can check it directly?

Same issue. Followed install instructions, project was working fine but since I updated, cannot compile the iOS project anymore.

Environment

react-native-code-push version: 5.6.0
react-native version: 0.59.3
Using CocoaPods in project and CodePush was installed manually

Current workaround found, adding the missing lib manually to the CodePush Pods project :
Screen Shot 2019-05-06 at 21 08 45

Hey @rdewolff, thanks for reporting!

Followed install instructions, project was working fine but since I updated, cannot compile the iOS project anymore.

Do you mean this instructions?

I think the issue came from double install : via node_module include and via Cocoapods.
Anyway, I solved it.

For anyone who might encounter this - here's the workaround I've found.

In my project, React Native was included through CocoaPods. When including CodePush through CocoaPods, the React/RCTEventEmitter.h file not found error would arise from the CodePush project. When CodePush was linked manually (not via Pods), everything worked.

In order to use CodePush as a pod, I had to remove the React Native libraries from the Xcode project, so they are only included through CocoaPods. If you do this, note two things:

  • Make sure to properly configure the React pod subspecs to match the libraries you're using.
  • If you have other libraries manually linked, they may stop working and you'll have to integrate them as pods.

Hey @erandagan,
Thanks for your explanation, it's really helpful!

@felixchan We haven't heard from you in a while, unfortunately. I'm going to close this issue for now. Please let us know if you still need our help, feel free to reopen the issue if needed!

Current workaround found, adding the missing lib manually to the CodePush Pods project :
Screen Shot 2019-05-06 at 21 08 45

I click " +" ,but i donot find RCTEventEmitter.h ,how do you find that

@gh7800 me too. help

I cannot find RCTEventEmitter.h either... Can someone help?

I cannot find RCTEventEmitter.h either... Can someone help?

After you press "+" you must then press "add other" as it is outside the Pods folder. It should be within node_modules/react-native/React/Modules.

I'm not sure anyway if this is the right way to fixing the issue as per this comment: https://github.com/facebook/react-native/issues/12042#issuecomment-275729402

I cannot find RCTEventEmitter.h either... Can someone help?

After you press "+" you must then press "add other" as it is outside the Pods folder. It should be within node_modules/react-native/React/Modules.

I'm not sure anyway if this is the right way to fixing the issue as per this comment: facebook/react-native#12042 (comment)

My issue was resolved by removing the line from my Pod file that was pointing the library that caused the issue to the node_modules path pod $libraryName, :path => $libraryPath

Replace #import RCTEventEmitter.h or #import React/RCTEventEmitter.h with #import <React/RCTEventEmitter.h>

Its work for me

Replace

import

With

if __has_include("RCTEventEmitter.h")

#import "RCTEventEmitter.h"

else

#import

endif

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisjrex picture chrisjrex  路  4Comments

ACCTFORGH picture ACCTFORGH  路  3Comments

fanzhiri picture fanzhiri  路  3Comments

EdmundMai picture EdmundMai  路  4Comments

cgerikj picture cgerikj  路  3Comments