software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.61k stars 1.27k forks source link

[3.6.0] pod install error after upgrading 3.6.0 #6021

Closed AuroPick closed 1 month ago

AuroPick commented 1 month ago

Description

I have upgraded react-native-reanimated version to 3.6.0 from 3.5.4 and started to getting this error when trying to install pods

[!] An error occurred while processing the post-install hook of the Podfile.

no implicit conversion of nil into String

/Users/aykutsaki/Desktop/xxx/xxx/node_modules/react-native/scripts/cocoapods/utils.rb:77:in `join'
/Users/aykutsaki/Desktop/xxx/xxx/node_modules/react-native/scripts/cocoapods/utils.rb:77:in `block (2 levels) in set_node_modules_user_settings'
/Users/aykutsaki/Desktop/xxx/xxx/node_modules/react-native/scripts/cocoapods/utils.rb:76:in `each'
/Users/aykutsaki/Desktop/xxx/xxx/node_modules/react-native/scripts/cocoapods/utils.rb:76:in `block in set_node_modules_user_settings'
/Users/aykutsaki/Desktop/xxx/xxx/node_modules/react-native/scripts/cocoapods/utils.rb:75:in `each'
/Users/aykutsaki/Desktop/xxx/xxx/node_modules/react-native/scripts/cocoapods/utils.rb:75:in `set_node_modules_user_settings'
/Users/aykutsaki/Desktop/xxx/xxx/node_modules/react-native/scripts/react_native_pods.rb:247:in `react_native_post_install'
/Users/aykutsaki/Desktop/xxx/xxx/ios/Podfile:117:in `block (2 levels) in from_ruby'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:196:in `post_install!'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1013:in `run_podfile_post_install_hook'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1001:in `block in run_podfile_post_install_hooks'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:149:in `message'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1000:in `run_podfile_post_install_hooks'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:337:in `block (2 levels) in create_and_save_projects'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:336:in `block in create_and_save_projects'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:315:in `create_and_save_projects'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:307:in `generate_pods_project'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:183:in `integrate'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:170:in `install!'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.15.2/libexec/bin/pod:25:in `<main>'

Podfile:

# react-native-permissions
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!

# react-native-permissions
setup_permissions([
  'PhotoLibrary',
  'Camera',
  'LocationWhenInUse',
  'LocationAccuracy'
])

# this is necessary for multiple environments do not delete
def shared
  # 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
  flipper_config = FlipperConfiguration.disabled

  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

  $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 is now enabled by default. Disable by setting this flag to false.
    :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}/.."
  )

  # @react-native-firebase/analytics@18.6.1 is using FirebaseAnalytics version 11. GoogleTagManager should also use this
  # if @react-native-firebase/analytics changes FirebaseAnalytics version. check version
  pod 'GoogleTagManager', '7.4.3'
end

target 'xxx' do
  Pod::UI.puts 'building xxx'

  shared

  target 'xxxTests' do
    Pod::UI.puts 'building xxxTests'

    inherit! :complete
    # Pods for testing
  end
end

target 'xxxPreprod' do
  Pod::UI.puts 'building xxxPreprod'

  shared
end

target 'xxxStaging' do
  Pod::UI.puts 'building xxxStaging'

  shared
end

target 'ourCompanyxxx' do
  Pod::UI.puts 'building ourCompanyxxx'

  shared
end

target 'ourCompanyxxxPreprod' do
  Pod::UI.puts 'building ourCompanyxxxPreprod'

  shared
end

target 'ourCompanyxxxStaging' do
  Pod::UI.puts 'building ourCompanyxxxStaging'

  shared
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

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

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

Steps to reproduce

  1. install react-native-reanimated@3.6.0
  2. install pods

Snack or a link to a repository

https://snack.expo.io

Reanimated version

3.6.0

React Native version

0.72.6

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Paper (Old Architecture)

Build type

Other (please specify)

Device

None

Device model

No response

Acknowledgements

Yes

github-actions[bot] commented 1 month ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

szydlovsky commented 1 month ago

Hey @AuroPick! Before we go down the podifle and try finding any issues there - make sure to install pods the way react native now suggests: cd ios && bundle install && bundle exec pod install Let me know if anything changes. You could also clean caches before the operation - git clean -xdf in the project root (you will also need to reinstall packages after the clean)

AuroPick commented 1 month ago

Hi @szydlovsky

I tried but didn't work.

$config[:reactNativePath] becomes nil outside the shared def after upgrade to 3.6.0

I invoked use_native_modules! again in the post_install. It looks like it is working.

post_install do |installer|
  config = use_native_modules!

  # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
  Pod::UI.puts "reactNativePath #{config[:reactNativePath]}"
  react_native_post_install(
    installer,
    config[:reactNativePath],
    :mac_catalyst_enabled => false
  )
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
end
szydlovsky commented 1 month ago

@AuroPick If you say it works then I can safely close the issue, especially that the logs of the pod install don't point to anything associated with Reanimated