cocoapods

Invalid `Podfile` file: undefined method `exists?' for File:Class


I am facing an issue with Podfile as below while installing pod in Xcode project.

Invalid Podfile file: undefined method `exists?' for File:Class

I did try to update pod version with brew upgrade cocoapods and also followed below link:

https://dev.to/retyui/fix-a-pod-install-error-undefined-method-exist-for-fileclass-react-native-24ke

But still no fix.

Please guide me what am I doing wrong here.

Below is my Podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'


flutter_application_path = '../bmi_flutter'
    
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

target 'MixedNativeApp' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  install_all_flutter_pods(flutter_application_path)
  # Pods for MixedNativeApp

  target 'MixedNativeAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MixedNativeAppUITests' do
    # Pods for testing
  end

end

Solution

  • Here is my solution for above problem (Posting if it could be helpful for devs in same situation)

    gem cleanup
    brew uninstall cocoapods
    sudo gem uninstall cocoapods
    sudo gem install cocoapods -v 1.10.0 -n /usr/local/bin   ***`add cocoapod version u want to install`***
    sudo gem install cocoapods-user-defined-build-types
    pod install --repo-update