Table of contents

React Native Error: 'event2/event-config.h' file not found

React Native Jul 10, 2021 Viewed 179 Comments 0

Issue

Development Version:
Xcode: 12.4
React Native: 0.63.2

Recently I deleted the node_modules folder under the React Native project, and run yarn install && cd ios && rm -rf Pods && rm Podfile.lock && pod install. When compiling in Xcode, I got an error saying: 'event2/event-config.h' file not found, as shown below:

Xcode compile error: 'event2/event-config.h' file not found

The content of my Podfile is as follows:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'test' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  target 'testTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'test-tvOS' do
  # Pods for test-tvOS

  target 'test-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

Solution 1

Delete the Flipper module. Delete or comment the following lines in the Podfile file. If the AppDelegate.m file also has related Flipper code, it also needs to be delete or comment.

#  add_flipper_pods!
#  post_install do |installer|
#    flipper_post_install(installer)
#  end

Solution 2

Keep the Flipper module and upgrade the Flipper-Folly version, for example to 2.3.0:

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
- use_flipper!
+ use_flipper!({ 'Flipper-Folly' => '2.3.0' }) # update this part
  post_install do |installer|
    flipper_post_install(installer)
  end
Updated Jul 10, 2021