Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PropsParserContext 'react/utils/ContextContainer.h' file not found #2081

Open
jason-digiex opened this issue Jul 4, 2023 · 9 comments
Open

Comments

@jason-digiex
Copy link

Bug

I've enabled Fabric in my latest RN project, so when I build it got this error 'react/utils/ContextContainer.h' file not found in PropsParserContext.h file.

Environment info

Run react-native info in your terminal and copy the results here. Also, include the precise version number of this library that you are using in the project

React native info output:

System:
  OS: macOS 14.0
  CPU: (8) arm64 Apple M1
  Memory: 192.75 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.15.0
    path: /usr/local/bin/node
  Yarn:
    version: 3.6.0
    path: /usr/local/bin/yarn
  npm:
    version: 9.5.0
    path: /usr/local/bin/npm
  Watchman:
    version: 2022.05.30.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /opt/homebrew/lib/ruby/gems/3.0.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - visionOS 1.0
      - Xcode 15.0
      - watchOS 10.0
  Android SDK:
    API Levels:
      - "23"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 29.0.3
      - 30.0.1
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.2 AI-222.4459.24.2221.10121639
  Xcode:
    version: 15.0/15A5161b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.15
    path: /usr/bin/javac
  Ruby:
    version: 3.1.2
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.1
    wanted: 0.72.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Library version: 13.9.0

Steps To Reproduce

Issues without reproduction steps or code are likely to stall.

  1. git clone https://github.com/jason-digiex/rnsvg-bug-repro
  2. cd rnsvg-bug-repro
  3. npm install
  4. RCT_NEW_ARCH_ENABLED=1 npx pod-install ios
  5. npm start
  6. Open ios/reprosvg.xcworkspace with Xcode
  7. Build app to for any iOS Simulartor (iPhone 14 Pro (Reosetta) for my case)

Describe what you expected to happen:

  1. The app should build successfully.
@YouuuMeee
Copy link

YouuuMeee commented Jul 4, 2023 via email

@hellogbg
Copy link

I have same problem

@ravindraguptacapgemini
Copy link

+1

@rditerwich
Copy link

rditerwich commented Jul 29, 2023

Workaround until resolved by react native:

Add 'react-native/ReactCommon' to the header search path in your Podfile (in my case, the "RNScreens" pod was giving the problem):

    installer.pods_project.targets.each do |target|
          if target.name == "RNScreens"
              append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
          end
        end

Also define the append_header_search_path in your Podfile:

  def append_header_search_path(target, path)
      target.build_configurations.each do |config|
          # Note that there's a space character after `$(inherited)`.
          config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
          config.build_settings["HEADER_SEARCH_PATHS"] << path
      end
  end

@daniel-toth-leeder
Copy link

Workaround until resolved by react native:

Add 'react-native/ReactCommon' to the header search path in your Podfile (in my case, the "RNScreens" pod was giving the problem):

    installer.pods_project.targets.each do |target|
          if target.name == "RNScreens"
              append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
          end
        end

Also define the append_header_search_path in your Podfile:

  def append_header_search_path(target, path)
      target.build_configurations.each do |config|
          # Note that there's a space character after `$(inherited)`.
          config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
          config.build_settings["HEADER_SEARCH_PATHS"] << path
      end
  end

I was able to fix the issue by extending the pods to which the header search path needed to be added

installer.pods_project.targets.each do |target|
	if ["RNScreens", "React-Fabric", "RNGestureHandler"].any? { |t| t == target.name }
		append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
	end
end

@guiathayde
Copy link

Workaround until resolved by react native:

Add 'react-native/ReactCommon' to the header search path in your Podfile (in my case, the "RNScreens" pod was giving the problem):

    installer.pods_project.targets.each do |target|
          if target.name == "RNScreens"
              append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
          end
        end

Also define the append_header_search_path in your Podfile:

  def append_header_search_path(target, path)
      target.build_configurations.each do |config|
          # Note that there's a space character after `$(inherited)`.
          config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
          config.build_settings["HEADER_SEARCH_PATHS"] << path
      end
  end

Where I add this code? In my Podfile show this error: [!] Invalid Podfile file: undefined local variable or method `installer' for #<Pod::Podfile:0x0000000103534428 @defined_in_file=#Pathname:/Users/guiathayde/apps/xati/mobile/ios/Podfile, @internal_hash={"installation_method"=>{"name"=>"cocoapods", "options"=>{:deterministic_uuids=>false}}}, @root_target_definitions=[#<Pod::Podfile::TargetDefinition label=Pods>], @current_target_definition=#<Pod::Podfile::TargetDefinition label=Pods>>.

@zjkuang
Copy link

zjkuang commented Sep 11, 2023

Workaround until resolved by react native:
Add 'react-native/ReactCommon' to the header search path in your Podfile (in my case, the "RNScreens" pod was giving the problem):

    installer.pods_project.targets.each do |target|
          if target.name == "RNScreens"
              append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
          end
        end

Also define the append_header_search_path in your Podfile:

  def append_header_search_path(target, path)
      target.build_configurations.each do |config|
          # Note that there's a space character after `$(inherited)`.
          config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
          config.build_settings["HEADER_SEARCH_PATHS"] << path
      end
  end

I was able to fix the issue by extending the pods to which the header search path needed to be added

installer.pods_project.targets.each do |target|
	if ["RNScreens", "React-Fabric", "RNGestureHandler"].any? { |t| t == target.name }
		append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
	end
end

This is indeed a life saving solution! Also fixed my issue, after having added some more targets in my project.

@zjkuang
Copy link

zjkuang commented Sep 11, 2023

Workaround until resolved by react native:
Add 'react-native/ReactCommon' to the header search path in your Podfile (in my case, the "RNScreens" pod was giving the problem):

    installer.pods_project.targets.each do |target|
          if target.name == "RNScreens"
              append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
          end
        end

Also define the append_header_search_path in your Podfile:

  def append_header_search_path(target, path)
      target.build_configurations.each do |config|
          # Note that there's a space character after `$(inherited)`.
          config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
          config.build_settings["HEADER_SEARCH_PATHS"] << path
      end
  end

Where I add this code? In my Podfile show this error: [!] Invalid Podfile file: undefined local variable or method `installer' for #<Pod::Podfile:0x0000000103534428 @defined_in_file=#Pathname:/Users/guiathayde/apps/xati/mobile/ios/Podfile, @internal_hash={"installation_method"=>{"name"=>"cocoapods", "options"=>{:deterministic_uuids=>false}}}, @root_target_definitions=[#<Pod::Podfile::TargetDefinition label=Pods>], @current_target_definition=#<Pod::Podfile::TargetDefinition label=Pods>>.

@guiathayde In your Podfile,

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if ["RNScreens", "React-Fabric", "RNGestureHandler"].any? { |t| t == target.name }
      append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
    end
  end
end

Note that the if-condition

if ["RNScreens", "React-Fabric", "RNGestureHandler"].any? { |t| t == target.name }

should be modified according to the actual targets in your project's Pod. e.g. in my project, it goes like

if ["React-cxxreact", "React-NativeModulesApple", "RNGestureHandler", "RNScreens"].any? { |t| t == target.name }

@Flawlessdawdwa
Copy link

post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
installer.pods_project.targets.each do |target|
if target.name == "React-Core-AccessibilityResources"
target.remove_from_project
end
end
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end

this is my Podfile's that code, i dont get it how to update it. im getting 'react/debug/react_native_assert.h' file not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants