react-native
react-native copied to clipboard
'RCTDevSettings.h' file not found
New Version
0.72.4
Old Version
0.70.8
Build Target(s)
ios simulator
Output of react-native info
System: OS: macOS 13.3.1 CPU: (8) arm64 Apple M1 Pro Memory: 102.48 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.17.1 path: ~/.nvm/versions/node/v18.17.1/bin/node Yarn: version: 1.22.17 path: /opt/homebrew/bin/yarn npm: version: 9.6.7 path: ~/.nvm/versions/node/v18.17.1/bin/npm Watchman: version: 2023.07.24.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 22.4 - iOS 16.4 - macOS 13.3 - tvOS 16.4 - watchOS 9.4 Android SDK: API Levels: - "26" - "29" - "30" - "31" - "33" Build Tools: - 29.0.2 - 29.0.3 - 30.0.2 - 30.0.3 - 31.0.0 - 33.0.0 System Images: - android-27 | ARM 64 v8a - android-30 | Google Play ARM 64 v8a - android-31 | Google APIs ARM 64 v8a - android-31 | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9619390 Xcode: version: 14.3.1/14E300c path: /usr/bin/xcodebuild Languages: Java: version: 11.0.16 path: /usr/bin/javac Ruby: version: 3.0.6 path: /Users/stefan/.rbenv/shims/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: true newArchEnabled: false
Issue and Reproduction Steps
Trying to build for ios simulator and I get this error
/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:22:9 'React/RCTDevSettings.h' file not found
Pod File `# require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native-permissions/scripts/setup'
Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p', 'require.resolve( "react-native/scripts/react_native_pods.rb", {paths: [process.argv[1]]}, )', dir]).strip
$RNFirebaseAsStaticFramework = true config = use_native_modules!
platform :ios, min_ios_version_supported prepare_react_native_project!
platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false
If you are using a react-native-flipper your iOS build will fail when NO_FLIPPER=1 is set.
because react-native-flipper depends on (FlipperKit,...) that will be excluded
To fix this you can also exclude react-native-flipper using a react-native.config.js
```js
module.exports = {
dependencies: {
...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
```
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
use_frameworks! :linkage => :static
target 'myApp' do
Flags change depending on the env values.
flags = get_default_flags()
use_react_native!( :path => config[:reactNativePath], # Hermes is now enabled by default. Disable by setting this flag to false. # Upcoming versions of React Native may rely on get_default_flags(), but # we make it explicit here to aid in the React Native upgrade process. :hermes_enabled => flags[:hermes_enabled], :fabric_enabled => flags[:fabric_enabled], # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. # :flipper_configuration => flipper_config, # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' permissions_path = '../node_modules/react-native-permissions/ios' setup_permissions([
'AppTrackingTransparency',
'BluetoothPeripheral',
'Calendars',
'Camera', 'Contacts', 'FaceID', 'LocationAccuracy', 'LocationAlways', 'LocationWhenInUse',
'MediaLibrary',
'Microphone',
'Motion',
'Notifications', 'PhotoLibrary', 'PhotoLibraryAddOnly',
'Reminders',
'SpeechRecognition',
'StoreKit'
]) pod 'OpenSSL-Universal', :modular_headers => true
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
pod 'react-native-geolocation-service', path: '../node_modules/react-native-geolocation-service'
target 'myAppTests' do inherit! :complete # Pods for testing end
pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
def pod.build_type;
Pod::BuildType.static_library
end
end
end
end
post_install do |installer|
# installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
# target_installation_result.native_target.build_configurations.each do |config|
# # For third party modules who have React-bridging dependency to search correct headers
# config.build_settings['HEADER_SEARCH_PATHS'] ||= '$(inherited) '
# config.build_settings['HEADER_SEARCH_PATHS'] << '"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging" '
# config.build_settings['HEADER_SEARCH_PATHS'] << '"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers" '
# end
# end
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
# Set mac_catalyst_enabled to true in order to apply patches
# necessary for Mac Catalyst builds
config[:reactNativePath],
:mac_catalyst_enabled => false
)
# NOTE: Change IPHONEOS_DEPLOYMENT_TARGET to 12.4.
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# config.build_settings['HEADER_SEARCH_PATHS'] ||= '$(inherited) '
# config.build_settings['HEADER_SEARCH_PATHS'] << '"${PODS_ROOT}/../../node_modules/react-native/ReactCommon" '
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
end
end
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end end `
| :warning: | Missing Reproducible Example |
|---|---|
| :information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
@Stefanpgr Any updates on this? I encounter the same issue.
IPHONEOS_DEPLOYMENT_TARGET @gobzila Honestly do not know how I fixed it. However I took these steps
- Delete pods
- Remove unused packages
- And modified my Podfile like below
- ran
pod install --repo-update
You can use this as reference to fix yours and make sure you followed the upgrade guidelines word for word here
` require Pod::Executable.execute_command('node', ['-p', 'require.resolve( "react-native/scripts/react_native_pods.rb", {paths: [process.argv[1]]}, )', dir]).strip
require_relative '../node_modules/react-native-permissions/scripts/setup'
platform :ios, min_ios_version_supported prepare_react_native_project!
flipper_config = FlipperConfiguration.disabled
use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true
target 'myApp' do config = use_native_modules!
flags = get_default_flags()
use_react_native!( :path => config[:reactNativePath], :hermes_enabled => flags[:hermes_enabled], :fabric_enabled => flags[:fabric_enabled], :app_path => "#{Pod::Config.instance.installation_root}/.." )
permissions_path = '../node_modules/react-native-permissions/ios' setup_permissions([ 'Camera', 'Contacts', 'FaceID', 'LocationAccuracy', 'LocationAlways', 'LocationWhenInUse', 'Notifications', 'PhotoLibrary', 'PhotoLibraryAddOnly', ]) pod 'OpenSSL-Universal', :modular_headers => true
pod 'react-native-geolocation-service', path: '../node_modules/react-native-geolocation-service'
target 'myAppTests' do inherit! :complete # Pods for testing end
pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
def pod.build_type;
Pod::BuildType.static_library
end
end
end
end
post_install do |installer| # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false ) __apply_Xcode_12_5_M1_post_install_workaround(installer) end end`
It was same in here, but for me the following changes in the Podfile helped:
- I moved the
pod 'podname', path: 'xxxpath'declarations from the beginning of the Podfile to the end of target declaration - I moved the
use_frameworks! :linkage => :staticdeclaration before the target
I also had the RCTDevSettings.h' file not found error (doing the 0.73 upgrade from 0.72). It took me a ridiculous amount of time to realize what was wrong in my podfile 🤦♀️
-> I was doing the post_install loop outside the target!
So my advices here:
- Check that this part of your podfile is in
target 'App' do(before itsend):
target 'RnDiffApp' do
[...]
post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install( ... )
[...]
end
end
- I agree with @Stefanpgr , really read line per line the reference Podfile given in the upgrade helper (or better, copy-past the full raw version in your code editor to have syntaxe highlighting and a global view - sometimes the part that makes it not working is not in what's changed! That was my case, doing the post-install outside the target did work on RN 0.72, but not on RN 0.73)
- Bonus, add the ruby extension to your code editor to have syntax check and auto-indentation (example for VSCode)
Thanks for all the suggestions above - the key line that helped us to resolve the 'React/RCTDevSettings.h' file not found build error was to ensure that the following config statement was within our target block.
target 'TheApp' do
config = use_native_modules!
...
As recommended above, following the reference Upgrade Helper Podfile helped us to track this down.
With previous versions of RN having this config statement outside of the target block did not seem to be a problem.
I was facing the same issue 'React/RCTDevSettings.h' file not found. My podfile has 2 targets (production and staging). I made it work moving config = use_native_modules! and post_install inside one target and removing the other one. The issue I am having now is the only way I made it work was defining the post_install inside the target but Podfile should have only one post_install hook defined so I am stuck for the second target.
Anyone had a similar issue?