Cocoapods: NoMethodError - undefined method `size' for nil:NilClass

Created on 13 Jan 2020  路  14Comments  路  Source: CocoaPods/CocoaPods

Command

/Users/cnxxxx/.rvm/gems/ruby-2.4.5/bin/pod install --verbose

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.8.4
        Ruby : ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-darwin19]
    RubyGems : 3.1.2
        Host : Mac OS X 10.15.2 (19C57)
       Xcode : 11.3 (11C29)
         Git : git version 2.21.0 (Apple Git-122.2)
Ruby lib dir : /Users/cnxxxx/.rvm/rubies/ruby-2.4.5/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0

Podfile

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
inhibit_all_warnings!
use_native_modules!
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

target 'xxxxxxx' do
  # Pods for xxxxxxx
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
  pod 'react-native-video/VideoCaching', :path => '../node_modules/react-native-video/react-native-video.podspec'
  pod 'Firebase/Core', '~> 6.3.0'
  pod 'GoogleIDFASupport', '~> 3.14.0'
  pod 'Firebase/Messaging', '~> 6.3.0'
  pod 'Fabric', '~> 1.10.2'
  pod 'Crashlytics', '~> 3.13.2'
  pod 'Firebase/DynamicLinks', '~> 6.3.0'
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
  pod 'JWT', '~> 3.0.0-beta.12'
end


target 'xxxxxxxProd' do
  # Pods for xxxxxxxProd
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
  pod 'react-native-video/VideoCaching', :path => '../node_modules/react-native-video/react-native-video.podspec'
  pod 'Firebase/Core', '~> 6.3.0'
  pod 'GoogleIDFASupport', '~> 3.14.0'
  pod 'Firebase/Messaging', '~> 6.3.0'
  pod 'Fabric', '~> 1.10.2'
  pod 'Crashlytics', '~> 3.13.2'
  pod 'Firebase/DynamicLinks', '~> 6.3.0'
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
  pod 'JWT', '~> 3.0.0-beta.12'
end

Error

NoMethodError - undefined method `size' for nil:NilClass
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho/macho_file.rb:455:in `populate_mach_header'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho/macho_file.rb:233:in `populate_fields'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho/macho_file.rb:55:in `initialize_from_bin'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho/macho_file.rb:33:in `new_from_bin'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho/fat_file.rb:365:in `block in populate_machos'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho/fat_file.rb:364:in `each'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho/fat_file.rb:364:in `populate_machos'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho/fat_file.rb:156:in `populate_fields'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho/fat_file.rb:95:in `initialize'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho.rb:31:in `new'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/ruby-macho-1.4.0/lib/macho.rb:31:in `open'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/sandbox/file_accessor.rb:457:in `dynamic_binary?'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/sandbox/file_accessor.rb:171:in `block in vendored_dynamic_frameworks'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/sandbox/file_accessor.rb:170:in `select'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/sandbox/file_accessor.rb:170:in `vendored_dynamic_frameworks'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/sandbox/file_accessor.rb:259:in `vendored_dynamic_artifacts'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:1123:in `block (3 levels) in <class:AggregateTargetSettings>'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:1122:in `any?'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:1122:in `block (2 levels) in <class:AggregateTargetSettings>'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:1121:in `any?'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:1121:in `block in <class:AggregateTargetSettings>'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:114:in `block in define_build_settings_method'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:1113:in `block in <class:AggregateTargetSettings>'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:114:in `block in define_build_settings_method'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:362:in `public_send'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:362:in `block in to_h'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:361:in `each'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:361:in `to_h'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:174:in `block in <class:BuildSettings>'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:970:in `block in <class:AggregateTargetSettings>'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:114:in `block in define_build_settings_method'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/target/build_settings.rb:190:in `save_as'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb:24:in `update_changed_file'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:102:in `block in create_xcconfig_file'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:98:in `each'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:98:in `create_xcconfig_file'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:18:in `block in install!'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:14:in `install!'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator.rb:130:in `block (2 levels) in install_aggregate_targets'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator.rb:128:in `map'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator.rb:128:in `block in install_aggregate_targets'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator.rb:127:in `install_aggregate_targets'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/single_pods_project_generator.rb:20:in `generate!'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:308:in `block in create_and_save_projects'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:303:in `create_and_save_projects'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:294:in `generate_pods_project'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:173:in `integrate'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:162:in `install!'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/bin/pod:23:in `load'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/bin/pod:23:in `<main>'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/bin/ruby_executable_hooks:24:in `eval'
/Users/cnxxxx/.rvm/gems/ruby-2.4.5/bin/ruby_executable_hooks:24:in `<main>'
awaiting input need sample

Most helpful comment

Delete these files

Podfile.lock
Pods\
Flutter\App.framework
Flutter\Flutter.framework
Flutter\Flutter.podspec

And pod update again will fix this issue. But I don't know why.

All 14 comments

gem update ruby-macho
does not work for me!
and I never set up the Flutter environment

OK please provide a sample app then. It looks like you are using ReactNative in your project so it might be an issue with that.

Please make the sample app as small as possible and only use CocoaPods so we can reproduce.

Same issue here.

Try deleting the Podfile.lock and running pod install again. Worked for me (as I had a repeated dependency added after an automatic git merge).

Guys did you try pod update?
It solved my issue...

Clear the pods folder contents and run pod install

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

鎴戜篃鍑虹幇浜嗚繖涓棶棰橈紝Try deleting the Podfile.lock and running pod install again锛屽苟娌℃湁瑙e喅闂

Delete these files

Podfile.lock
Pods\
Flutter\App.framework
Flutter\Flutter.framework
Flutter\Flutter.podspec

And pod update again will fix this issue. But I don't know why.

Delete these files

Podfile.lock
Pods
Flutter\App.framework
Flutter\Flutter.framework
Flutter\Flutter.podspec

And pod update again will fix this issue. But I don't know why.

@JIAZoro except for this,and use --verbose,is working for me

pod install --verbose

Delete these files

Podfile.lock
Pods
Flutter\App.framework
Flutter\Flutter.framework
Flutter\Flutter.podspec

And pod update again will fix this issue. But I don't know why.

This worked for me after many hours of pain. Thank you! It is weird because even deleting the whole ios folder didn't work, but deleting these ones in particular did the trick.

flutter clean
flutter pub get
pod install
problem solving

Delete these files

Podfile.lock
Pods
Flutter\App.framework
Flutter\Flutter.framework
Flutter\Flutter.podspec

And pod update again will fix this issue. But I don't know why.

Worked for me thank you so much you saved my day

Was this page helpful?
0 / 5 - 0 ratings