Invalid `Podfile` file: undefined method `[]' for nil:NilClass.

See original GitHub issue

Environment

System:
    OS: macOS 10.15.1
    CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
    Memory: 62.27 MB / 16.00 GB
    Shell: 5.0.11 - /usr/local/bin/bash
  Binaries:
    Node: 12.13.0 - /var/folders/n_/30jh5m816yzg3_cftvg647j40000gn/T/yarn--1574276617063-0.927548752503313/node
    Yarn: 1.19.1 - /var/folders/n_/30jh5m816yzg3_cftvg647j40000gn/T/yarn--1574276617063-0.927548752503313/yarn
    npm: 6.13.0 - ~/.nvm/versions/node/v12.13.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 22, 23, 24, 25, 26, 27, 28
      Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.3, 28.0.0, 28.0.3
      System Images: android-25 | Android TV Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-N | Android TV Intel x86 Atom, android-N | Android Wear ARM EABI v7a, android-N | Android Wear Intel x86 Atom, android-N | Intel x86 Atom, android-N | Intel x86 Atom_64, android-P | Google Play Intel x86 Atom
      Android NDK: 20.1.5948944
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5977832
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    @react-native-community/cli: 3.0.4 => 3.0.4 
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.4 => 0.61.4 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-create-library: 3.1.2
    react-native-git-upgrade: 0.2.7

Description

[!] Invalid `Podfile` file: undefined method `[]' for nil:NilClass.

 #  from /app/packages/app/ios/Podfile:57
 #  -------------------------------------------
 #    # react_native_firebase!
 >    use_native_modules!
 #  end
 #  -------------------------------------------

Reproducible Demo

my podfile

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

# plugin 'cocoapods-fix-react-native'git st
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
# require_relative '../node_modules/@react-native-firebase/app/pod_config'

project 'app', { 'Alpha' => :release, 'Staging' => :release }

target 'app' do
  # Comment the next line if you don't want to use dynamic frameworks
  # use_frameworks!

  # Pods for app
  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-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-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  # pod 'React-RCTLinking', :podspec => '../node_modules/react-native/Libraries/LinkingIOS/React-RCTLinking.podspec'

  pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios/RNFirebase.podspec'

  pod 'Firebase/Core'
  pod 'Firebase/Messaging'

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

  # react_native_firebase!
  use_native_modules!
end

target 'app-tvOS' do
  # Comment the next line if you don't want to use dynamic frameworks
  # use_frameworks!

  # Pods for app-tvOS

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

end

this is a monorepo setup

this is a list of react-native packages used

"@react-native-community/async-storage": "1.6.3",
"@react-native-community/cameraroll": "^1.3.0",
"@react-native-community/cli": "3.0.4",
    "@react-native-community/cli-platform-android": "3.0.3",
    "@react-native-community/cli-platform-ios": "3.0.0",
"react-native-camera": "3.11.1",
    "react-native-device-info": "5.3.1",
    "react-native-document-picker": "3.2.4",
"react-native-firebase": "5.5.6",
    "react-native-gesture-handler": "1.5.0",
    "react-native-image-resizer": "1.1.0",
"react-native-linear-gradient": "2.5.6",
    "react-native-localization": "2.1.6",
    "react-native-reanimated": "1.4.0",
    "react-native-screens": "2.0.0-alpha.11",
    "react-native-splash-screen": "3.2.0",
    "react-native-svg": "9.13.3",
    "react-native-tts": "3.0.0",
    "react-native-voice": "git+https://github.com/wenkesj/react-native-voice.git#62a3a0e40fece93c0d4b5c664d563207a960ef87",
    "react-native-webview": "7.5.1",
    "reanimated-bottom-sheet": "1.0.0-alpha.16",
    ```

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:30 (14 by maintainers)

github_iconTop GitHub Comments

18reactions
ahmaddehnavicommented, Jan 1, 2021

I had upgraded from 61.5 to 63.1 and my problem solved when removing path param from use_react_native! in podfile something like this: config = use_native_modules! use_react_native!

17reactions
sibeliuscommented, Nov 21, 2019

fixed removing

@react-native-community/cli @react-native-community/cli-platform-android @react-native-community/cli-platform-ios

instead I’ve used the one that react-native 61 depends on

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native - iOS - Invalid `Podfile` file: undefined method ...
This error happens when you cd to ios folder and run "pod install" and is because you added a new react native module...
Read more >
[!] Invalid `Podfile` file: undefined method `[]' for nil:NilClass.
Same here. If your package.json file includes @react-native-community/cli* they are probably the wrong versions. Remove them from your package.
Read more >
iOS - Invalid `Podfile` file: undefined method `[]' for nil:NilClass
My problem is running pod install inside my ios/ folder always results in an error! This becomes a problem now where I need...
Read more >
`undefined method `[]' for nil:NilClass` error during upgrading
GitLab update 15.0.4 -> 15.1.1 fails on Ubuntu 22.04 ARM64: NoMethodError: undefined method `[]' for nil:NilClass.
Read more >
why isn't the pod file working?! | Apple Developer Forums
Invalid Podfile file : undefined method `Pod' for #Pod::Podfile:0x00007fcd953068c0. has anyone had this before and what can I do to resolve this?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found