react-native: 'FBReactNativeSpec/FBReactNativeSpec.h' file not found

Description

Hello, i’m getting this error 'FBReactNativeSpec/FBReactNativeSpec.h' file not foundwith the stacktrace below.

Podfile

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

require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

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

# flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

def fix_library_search_paths(installer)
  def fix_config(config)
    lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
    if lib_search_paths
      if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
        # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
        # since the libraries there are only built for x86_64 and i386.
        lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
        lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
        if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
          # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
          lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
        end
      end
    end
  end

  def _apply_Xcode_14_3_RC_post_install_workaround(installer)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        current_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
        minimum_target = '13.0'
        if current_target.to_f < minimum_target.to_f
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
        end
      end
    end
  end

  projects = installer.aggregate_targets
    .map{ |t| t.user_project }
    .uniq{ |p| p.path }
    .push(installer.pods_project)

  projects.each do |project|
    project.build_configurations.each do |config|
      fix_config(config)
    end
    project.native_targets.each do |target|
      target.build_configurations.each do |config|
        fix_config(config)
      end
    end
    project.save()
  end
end

target 'XXX' do
  config = use_native_modules!

  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => false,
    :fabric_enabled => flags[:fabric_enabled],
    :flipper_configuration => FlipperConfiguration.disabled,
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )



  pod 'react-native-config/Extension', :path => '../node_modules/react-native-config'

  # pod 'RNFBFunctions', :path => '../node_modules/@react-native-firebase/functions'

  # pod 'Firebase', :modular_headers => true
  # pod 'Firebase/Storage', :modular_headers => true
  # pod 'FirebaseCore', :modular_headers => true
  # pod 'FirebaseCoreInternal', :modular_headers => true
  # pod 'GoogleUtilities', :modular_headers => true
  # pod 'FirebaseAppCheckInterop', :modular_headers => true
  # pod 'FirebaseAuthInterop', :modular_headers => true
  # pod 'FirebaseCoreExtension', :modular_headers => true
  # pod 'GTMSessionFetcher', :modular_headers => true

  target 'XXXTests' 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|
    # __apply_Xcode_12_5_M1_post_install_workaround(installer)
    installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
      configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
    end
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
        config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
        config.build_settings['CODE_SIGN_IDENTITY'] = ''
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
      end
    end
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    fix_library_search_paths(installer)
    # _apply_Xcode_14_3_RC_post_install_workaround(installer)
  end
end

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

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

workspace 'XXX.xcworkspace'

And these are the dependencies I’m using in my package.json:

"dependencies": {
    "@bam.tech/react-native-image-resizer": "^3.0.5",
    "@notifee/react-native": "^5.6.0",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-native-clipboard/clipboard": "^1.10.0",
    "@react-native-community/datetimepicker": "^7.6.2",
    "@react-native-firebase/analytics": "17.3.0",
    "@react-native-firebase/app": "17.3.0",
    "@react-native-firebase/auth": "17.3.0",
    "@react-native-firebase/firestore": "17.3.0",
    "@react-native-firebase/functions": "17.3.0",
    "@react-native-firebase/messaging": "17.3.0",
    "@react-native-firebase/storage": "17.3.0",
    "@react-native-picker/picker": "^2.2.1",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/stack": "^6.3.20",
    "@sentry/react-native": "^4.14.0",
    "@stripe/stripe-react-native": "^0.33.0",
    "@tanstack/query-async-storage-persister": "^4.29.5",
    "@tanstack/react-query": "^4.29.5",
    "@tanstack/react-query-persist-client": "^4.29.5",
    "AsyncStorage": "^0.1.5",
    "dayjs": "^1.11.8",
    "firebase": "^8.2.2",
    "i18next": "^21.3.3",
    "moment": "^2.29.1",
    "numeral": "^2.0.6",
    "prettier": "^2.8.8",
    "qs": "^6.10.4",
    "react": "18.2.0",
    "react-i18next": "^11.13.0",
    "react-native": "^0.73.0",
    "react-native-app-intro-slider": "^4.0.4",
    "react-native-calendars": "^1.1284.0",
    "react-native-chart-kit": "^6.12.0",
    "react-native-config": "^1.4.5",
    "react-native-document-picker": "^8.1.3",
    "react-native-gesture-handler": "^2.14.0",
    "react-native-google-places-autocomplete": "^2.2.0",
    "react-native-image-crop-picker": "^0.39.0",
    "react-native-image-viewing": "^0.2.2",
    "react-native-localize": "^2.1.5",
    "react-native-maps": "^0.27.1",
    "react-native-modal-datetime-picker": "^13.1.2",
    "react-native-push-notification": "^8.1.1",
    "react-native-safe-area": "^0.5.1",
    "react-native-safe-area-context": "^4.8.2",
    "react-native-screens": "^3.21.0",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^14.0.0",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-vector-icons": "^9.0.0",
    "react-native-web": "0.19.4",
    "react-native-webview": "^13.6.1"
  },
  "devDependencies": {
    "@babel/core": "7.12.9",
    "@babel/runtime": "7.12.5",
    "@react-native-community/eslint-config": "1.1.0",
    "@types/jest": "^27.5.1",
    "@types/react": "^17.0.2",
    "@types/react-native": "0.71.6",
    "@types/react-test-renderer": "18.0.0",
    "babel-jest": "25.5.1",
    "eslint": "6.8.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.59.0",
    "react-test-renderer": "18.2.0",
    "typescript": "^4.6.4"
  },

This does not work with RN version 0.71.7 or latest version 0.73.0.

This works correctly on Android though.

Sorry I’m not sure if this is what was expected from the reproducer, let me know if I need to update anything

Do you have any idea why I got this error and how to fix it? Thanks in advance for your help 🙏🏻

Steps to reproduce

  • npm i
  • pod install
  • press run from Xcode

React Native Version

0.73.0

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.1.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 151.02 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.2.0
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 9.6.6
    path: /usr/local/bin/npm
  Watchman:
    version: 2023.06.12.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /opt/homebrew/lib/ruby/gems/3.2.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
    Build Tools:
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 33.0.0
      - 34.0.0
    System Images:
      - android-28 | Google APIs ARM 64 v8a
      - android-28 | Google ARM64-V8a Play ARM 64 v8a
      - android-29 | Google APIs ARM 64 v8a
      - android-29 | Google Play ARM 64 v8a
      - android-30 | Google APIs ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-32 | Google APIs ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.11090377
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.1
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

CompileC /Users/marion/Documents/XXX-app/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTVibration.build/Objects-normal/x86_64/RCTVibration.o /Users/marion/Documents/XXX-app/node_modules/react-native/Libraries/Vibration/RCTVibration.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-RCTVibration' from project 'Pods')
    cd /Users/marion/Documents/XXX-app/ios/Pods
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -ivfsstatcache /Users/marion/Documents/XXX-app/ios/DerivedData/SDKStatCaches.noindex/iphonesimulator17.2-21C52-4f2951bfe8f3cd53c99228b0131e163e.sdkstatcache -target x86_64-apple-ios13.4-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fno-color-diagnostics -std\=c++20 -stdlib\=libc++ -fobjc-arc -fmodules -gmodules -fmodules-cache-path\=/Users/marion/Documents/XXX-app/ios/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/marion/Documents/XXX-app/ios/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -fmodule-name\=RCTVibration -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-c++11-extensions -Wno-implicit-fallthrough -DPOD_CONFIGURATION_DEBUG\=1 -DDEBUG\=1 -DCOCOAPODS\=1 -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.2.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility-inlines-hidden -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -fobjc-abi-version\=2 -fobjc-legacy-dispatch -index-store-path /Users/marion/Documents/XXX-app/ios/DerivedData/XXX/Index.noindex/DataStore -iquote /Users/marion/Documents/XXX-app/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTVibration.build/RCTVibration-generated-files.hmap -I/Users/marion/Documents/XXX-app/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTVibration.build/RCTVibration-own-target-headers.hmap -I/Users/marion/Documents/XXX-app/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTVibration.build/RCTVibration-all-non-framework-target-headers.hmap -ivfsoverlay /Users/marion/Documents/XXX-app/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTVibration.build/all-product-headers.yaml -iquote /Users/marion/Documents/XXX-app/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTVibration.build/RCTVibration-project-headers.hmap -I/Users/marion/Documents/XXX-app/ios/Build/Products/Debug-iphonesimulator/React-RCTVibration/include -I/Users/marion/Documents/XXX-app/ios/Build/Products/Debug-iphonesimulator/ReactCommon/ReactCommon.framework/Headers -I/Users/marion/Documents/XXX-app/ios/Build/Products/Debug-iphonesimulator/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core -I/Users/marion/Documents/XXX-app/ios/Build/Products/Debug-iphonesimulator/ReactCommon-Samples/ReactCommon_Samples.framework/Headers -I/Users/marion/Documents/XXX-app/ios/Build/Products/Debug-iphonesimulator/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios -I/Users/marion/Documents/XXX-app/ios/Build/Products/Debug-iphonesimulator/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx -I/Users/marion/Documents/XXX-app/ios/Build/Products/Debug-iphonesimulator/React-NativeModulesApple/React_NativeModulesApple.framework/Headers -I/Users/marion/Documents/XXX-app/ios/Build/Products/Debug-iphonesimulator/React-graphics/React_graphics.framework/Headers -I/Users/marion/Documents/XXX-app/ios/Build/Products/Debug-iphonesimulator/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios -
    ... 
    -DFOLLY_NO_CONFIG -DFOLLY_MOBILE\=1 -DFOLLY_USE_LIBCPP\=1 -DFOLLY_CFG_NO_COROUTINES\=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-nullability-completeness -include /Users/marion/Documents/XXX-app/ios/Pods/Target\ Support\ Files/React-RCTVibration/React-RCTVibration-prefix.pch -MMD -MT dependencies -MF /Users/marion/Documents/XXX-app/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTVibration.build/Objects-normal/x86_64/RCTVibration.d --serialize-diagnostics /Users/marion/Documents/XXX-app/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTVibration.build/Objects-normal/x86_64/RCTVibration.dia -c /Users/marion/Documents/XXX-app/node_modules/react-native/Libraries/Vibration/RCTVibration.mm -o /Users/marion/Documents/XXX-app/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTVibration.build/Objects-normal/x86_64/RCTVibration.o -index-unit-output-path /Pods.build/Debug-iphonesimulator/React-RCTVibration.build/Objects-normal/x86_64/RCTVibration.o

/node_modules/react-native/Libraries/Vibration/RCTVibration.mm:11:9: fatal error: 'FBReactNativeSpec/FBReactNativeSpec.h' file not found
#import <FBReactNativeSpec/FBReactNativeSpec.h>


### Reproducer

https://github.com/toscalivia83/XXX-repro

### Screenshots and Videos

<img width="1134" alt="Capture d’écran 2024-01-08 à 20 08 00" src="https://github.com/facebook/react-native/assets/19326704/7a9f6a1b-8e54-4ec2-889d-13113ec6b142">

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Comments: 19 (4 by maintainers)

Most upvoted comments

@cipolleschi Creating a new repo helped me to fix the problem because I could add all the dependencies one by one and upgrade the versions. Now it works with the package.json and Podfile I posted above. Thanks for your help so far! 🙏

@DanielJaimes unfortunately I tried that but it did not work for me

@Alcoholic-Obelix the error of that build is the one mentioned at the top in “Stacktrace or Logs”. It did not change

I think this happened to me as well after updating to xcode 15. I tried updating to Xcode 15.2, but it doesn’t work either. I’ll try downgrading Xcode maybe. If you find any fix let me know

However I keep having this error I logged here

This is happening on our CI environment as well when we updated to xcode15, locally it works however we get the exact same error in our CI building the app