0

I upgraded react native from 0.72 to 0.73.8, but when I try to install the pods with pod install I get the following error:

Downloading dependencies
Generating Pods project
Setting USE_HERMES build settings
Setting REACT_NATIVE build settings
[!] An error occurred while processing the post-install hook of the Podfile.

no implicit conversion of nil into String

/Users/francescoclementi/Documents/develop/parkinglesscustomer/node_modules/react-native/scripts/cocoapods/utils.rb:130:in `join'
/Users/francescoclementi/Documents/develop/parkinglesscustomer/node_modules/react-native/scripts/cocoapods/utils.rb:130:in `block (2 levels) in set_node_modules_user_settings'
/Users/francescoclementi/Documents/develop/parkinglesscustomer/node_modules/react-native/scripts/cocoapods/utils.rb:129:in `each'
/Users/francescoclementi/Documents/develop/parkinglesscustomer/node_modules/react-native/scripts/cocoapods/utils.rb:129:in `block in set_node_modules_user_settings'
/Users/francescoclementi/Documents/develop/parkinglesscustomer/node_modules/react-native/scripts/cocoapods/utils.rb:128:in `each'
/Users/francescoclementi/Documents/develop/parkinglesscustomer/node_modules/react-native/scripts/cocoapods/utils.rb:128:in `set_node_modules_user_settings'
/Users/francescoclementi/Documents/develop/parkinglesscustomer/node_modules/react-native/scripts/react_native_pods.rb:307:in `react_native_post_install'
/Users/francescoclementi/Documents/develop/parkinglesscustomer/ios/Podfile:55:in `block (2 levels) in from_ruby'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:196:in `post_install!'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1013:in `run_podfile_post_install_hook'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1001:in `block in run_podfile_post_install_hooks'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:149:in `message'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1000:in `run_podfile_post_install_hooks'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:337:in `block (2 levels) in create_and_save_projects'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:336:in `block in create_and_save_projects'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:315:in `create_and_save_projects'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:307:in `generate_pods_project'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:183:in `integrate'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:170:in `install!'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:in `run'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in `run'
/Users/francescoclementi/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/bin/pod:55:in `<top (required)>'
/Users/francescoclementi/.rbenv/versions/2.7.4/bin/pod:23:in `load'
/Users/francescoclementi/.rbenv/versions/2.7.4/bin/pod:23:in `<main>'

This is my pod file:

# 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

platform :ios, min_ios_version_supported
prepare_react_native_project!


def share_pods (target_name)
  # 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

  target target_name do

    $config = use_native_modules!

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

    use_react_native!(
      :path => $config[:reactNativePath],
      # 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}/.."
    )
  end
end

share_pods('target1')
share_pods('target1-prod') 

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
  )
end

If I remove the react_native_post_install it will work fine, but it's not the correct solution

1 Answer 1

0

Looks like error raises while execute this line

https://github.com/facebook/react-native/blob/c39538b79dbc7f84b536431ac2230d259f846e42/packages/react-native/scripts/cocoapods/utils.rb#L130

because $config[:reactNativePath] is nil

File.join('', '..', nil)
# TypeError: no implicit conversion of nil into String

Try to pass this value explicitly as string

react_native_post_install(
  installer,
  'path/here',
  :mac_catalyst_enabled => false
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.