invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.63k stars 2.2k forks source link

[🐛] 🔥 Can't run pod install --repo-update --project-directory=ios with react native 0.75.2 #7993

Open NiharR027 opened 2 weeks ago

NiharR027 commented 2 weeks ago

Issue

I am trying to migrate from react native 0.74.5 to 0.75.2 using https://react-native-community.github.io/upgrade-helper/?from=0.74.5&to=0.75.2.

Now all was good until I ran pod install --repo-update --project-directory=ios

It gives the below error:


[!] Invalid `Podfile` file: No such file or directory @ rb_sysopen - /Users/[USER_NAME]/Projects/node_modules/@react-native-firebase/app/ios_config.sh.

 #  from /Users/[USER_NAME]/Projects/[PROJECT_NAME]/ios/Podfile:62
 #  -------------------------------------------
 #    $RNFirebaseAsStaticFramework = true #https://rnfirebase.io/#altering-cocoapods-to-use-frameworks
 >    config = use_native_modules!
 #
 #  -------------------------------------------

Going to iOS and manually running pod install works fine. But the problem is running from the root directory, it just doesn't like it.

I have tried to delete node modules / cleaning yarn cache etc. this works fine with react native v0.74.5.


Project Files

Javascript

Click To Expand

#### `package.json`: ```json "@react-native-firebase/app": "^20.4.0", "@react-native-firebase/messaging": "^20.4.0", "react-native": "0.75.2", ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby def node_require(script) # Resolve script with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', "require.resolve( '#{script}', {paths: [process.argv[1]]}, )", __dir__]).strip end node_require('react-native/scripts/react_native_pods.rb') node_require('react-native-permissions/scripts/setup.rb') platform :ios, min_ios_version_supported prepare_react_native_project! # ⬇️ uncomment wanted permissions setup_permissions([ 'Camera', # 'Contacts', # 'FaceID', # 'LocationAccuracy', # 'LocationAlways', # 'LocationWhenInUse', # 'MediaLibrary', 'Microphone', # 'Motion', 'Notifications', # 'PhotoLibrary', # 'PhotoLibraryAddOnly', # 'Reminders', # 'Siri', # 'SpeechRecognition', # 'StoreKit', ]) $RNFirebaseAsStaticFramework = true # This "pre_install" is required for react-native-permissions, as a workaround for # adding use_frameworks!, which was a requirement for @react-native-firebase v15 onwards # See: https://www.npmjs.com/package/react-native-permissions#user-content-workaround-for-use_frameworks-issues # Convert all permission pods into static libraries 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; # Uncomment the line corresponding to your CocoaPods version Pod::BuildType.static_library # >= 1.9 # Pod::Target::BuildType.static_library # < 1.9 end end end end target 'Appname' do # use_frameworks! is required for @react-native-firebase v15 onwards use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true #https://rnfirebase.io/#altering-cocoapods-to-use-frameworks config = use_native_modules! use_react_native!( :path => config[:reactNativePath], # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) target 'AppNameTests' do inherit! :complete # Pods for testing end post_install do |installer| # There are issues building iOS with react-native-image-picker. As of 14 Sept 2023, # v7.0.0 was installed and we're getting the error: Could not build module 'React' # This comment, https://github.com/react-native-image-picker/react-native-image-picker/issues/2158#issuecomment-1612438367, suggests to add the following lines installer.pods_project.build_configurations.each do |config| config.build_settings["CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES"] = true end # 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, # :ccache_enabled => true ) fix_deployment_target(installer) fix_xcode14_code_signing_bug(installer) end end target 'Appname-tvOS' do # Pods for Appname-tvOS # This is required for @react-native-firebase v15 onwards use_frameworks! :linkage => :static target 'Appname-tvOSTests' do inherit! :search_paths # Pods for testing end end def fix_deployment_target(installer) return if !installer project = installer.pods_project project_deployment_target = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] puts "Make sure all pods deployment target is #{project_deployment_target.green}" project.targets.each do |target| puts " #{target.name}".blue target.build_configurations.each do |config| old_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] new_target = project_deployment_target next if old_target == new_target puts " #{config.name}: #{old_target.yellow} -> #{new_target.green}" config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = new_target end end end # Review this with the XCode upgrade (>14.2) and remove if no longer required. def fix_xcode14_code_signing_bug(installer) installer.pods_project.targets.each do |target| if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle" target.build_configurations.each do |config| config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' end end end end ```

russellwheatley commented 2 weeks ago

Not sure what is happening, at least it works when you run in the ios/ directory.

It does appear that this path is incorrect:

[!] Invalid `Podfile` file: No such file or directory @ rb_sysopen - /Users/[USER_NAME]/Projects/node_modules/@react-native-firebase/app/ios_config.sh.

It seems [PROJECT_NAME] is missing from path.

thespacemanatee commented 2 weeks ago

We're also seeing this behaviour after upgrading to 0.75, npx pod-install is a workaround but the problem is there.

elkinjosetm commented 2 weeks ago

+1

roamifydev commented 2 weeks ago

+1, i am not able to archive to xcode cloud due to this.

Error is:

[!] InvalidPodfilefile: No such file or directory @ rb_sysopen - /Volumes/workspace/repository/ios/node_modules/@react-native-firebase/app/ios_config.sh.

roamifydev commented 2 weeks ago

This could be related: https://github.com/reactwg/react-native-releases/issues/341

ngocleexuan commented 1 week ago

I have a problem on Xcode Cloud and this is my solution: bash /Volumes/workspace/repository/ios/node_modules/@react-native-firebase/app/ios_config.sh chmod +x /Volumes/workspace/repository/ios/node_modules/@react-native-firebase/app/ios_config.sh ci_post_clone.txt

hazyikmis commented 3 days ago

Adding the linepod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app' just before calling use_native_modules in Podfile fixed the issue in our case.

target 'your_app_name' do
  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
  config = use_native_modules!
  ...
  use_react_native!(...)
  ...
end

UPDATE: We see no error on when installing pods, but this change removes [CP-User] [RNFB] Core Configuration build phase from the project.pbxproj! Thats not good.