react-native-community / upgrade-support

A central community-backed place to request and give help when upgrading your app.
MIT License
252 stars 2 forks source link

pods: react_native_post_install fails with "undefined method 'build_configurations' for nil:NilClass" [0.62.2 -> 0.64.1] #160

Open jasongaare opened 3 years ago

jasongaare commented 3 years ago

Environment

System: OS: macOS 11.1 CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz Memory: 6.30 GB / 32.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 12.22.0 - ~/.nvm/versions/node/v12.22.0/bin/node Yarn: 1.22.5 - /usr/local/bin/yarn npm: 6.14.11 - ~/.nvm/versions/node/v12.22.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: Not Found SDKs: iOS SDK: Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 Android SDK: API Levels: 23, 25, 27, 28, 29 Build Tools: 28.0.3, 29.0.2 System Images: android-28 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.0 AI-193.6911.18.40.6514223 Xcode: 12.5/12E262 - /usr/bin/xcodebuild Languages: Java: 1.8.0_222 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.1 => 17.0.1 react-native: 0.64.1 => 0.64.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Things I’ve done to figure out my issue

Upgrading version

to: 0.64.1 from: 0.62.2

Description

I'm loving the much cleaner Podfile with the helpers for all the standard RN deps. However, I cannot get my pod install to complete with the post installer. This is the error I get:

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

undefined method `build_configurations' for nil:NilClass

/{rn-project-path}/node_modules/react-native/scripts/react_native_pods.rb:128:in `block in exclude_architectures'
/{rn-project-path}/node_modules/react-native/scripts/react_native_pods.rb:127:in `each'
/{rn-project-path}/node_modules/react-native/scripts/react_native_pods.rb:127:in `exclude_architectures'
/{rn-project-path}/node_modules/react-native/scripts/react_native_pods.rb:161:in `react_native_post_install'
/{rn-project-path}/ios/Podfile:38:in `block (3 levels) in from_ruby'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:897:in `run_podfile_post_install_hook'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:885:in `block in run_podfile_post_install_hooks'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:145:in `message'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:884:in `run_podfile_post_install_hooks'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:329:in `block (2 levels) in create_and_save_projects'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:328:in `block in create_and_save_projects'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:307:in `create_and_save_projects'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:299:in `generate_pods_project'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:178:in `integrate'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:166:in `install!'
/Users/gaare/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'

Podfile

Here is the entire of my Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

# this is to suppress some warnings, if you find the need to remove feel free to do so
install! 'cocoapods', :deterministic_uuids => false, :integrate_targets => false

target 'CompanyCam' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # iOS-specific Pods (not direct React Native dependencies)
  pod 'Mixpanel', '~> 3.6.3'
  pod 'GSSDK/Core', :podspec => 'https://s3.amazonaws.com/tgl.geniusscan.sdk/GSSDK-3.0.24.podspec'

  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  # use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
  end
end

I am not certain this is a RN-specific error, but I cannot get past this while upgrading, and haven't found much support else where online

akashdeep24 commented 7 months ago

got same issue while upgrading from 0.68.0 to 0.73.1 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!

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 'myapp' do config = use_native_modules!

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}/.."

)

target 'myappTests' do inherit! :complete

Pods for testing

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
)

end end`

Screenshot 2024-01-18 at 12 27 48 PM please help

chenkuangkuang commented 6 months ago

Same question. anyone help?

DePavlenko commented 4 months ago

++

parthkanani93 commented 2 months ago

++