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

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

Upgraded from v0.62.2 to v0.63.1. first tried react-native upgrade and used react native upgrade helper to change what’s not changed automatically.

Then did pod install this error happend.

pod install
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Detected React Native module pods for HeroPicker, RNAppleAuthentication, RNCAsyncStorage, RNFBApp, RNFBMessaging, RNFS, RNFastImage, RNGestureHandler, RNGoogleSignin, RNReanimated, RNScreens, ReactNativePermissions, kakao-login, react-native-apple-authentication, react-native-camera, react-native-cameraroll, react-native-contacts, react-native-fbsdk, react-native-image-base64, react-native-image-editor, react-native-image-picker, react-native-image-resizer, react-native-photo-zoom, react-native-view-shot, and react-native-webview

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

 #  from /Users/peter/App/ootd/ios/Podfile:9
 #  -------------------------------------------
 #  
 >    use_react_native!(:path => config[:reactNativePath])
 #  
 #  -------------------------------------------

react-native upgarde result ()

info No version passed. Fetching latest...
info Fetching diff between v0.62.2 and v0.63.1...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:

error Excluding files that failed to apply the diff:
  - android/app/build.gradle
  - android/build.gradle
  - android/gradle/wrapper/gradle-wrapper.properties
  - ios/Podfile
  - ios/ootd.xcodeproj/project.pbxproj
  - ios/ootd/AppDelegate.m
  - ios/ootd/Base.lproj/LaunchScreen.xib
Please make sure to check the actual changes after the upgrade command is finished.
You can find them in our Upgrade Helper web app: https://react-native-community.github.io/upgrade-helper/?from=0.62.2&to=0.63.1
error Automatically applying diff failed. We did our best to automatically upgrade as many files as possible
warn Continuing after failure. Some of the files are upgraded but you will need to deal with conflicts manually
info Installing "react-native@0.63.1" and its peer dependencies...
error Command failed: yarn add react-native@0.63.1 react@16.13.1
warning " > @react-native-community/cameraroll@1.7.2" has incorrect peer dependency "react-native@>=0.57 <=0.62".
warning " > @react-native-community/google-signin@3.0.4" has unmet peer dependency "prop-types@*".
warning " > @react-native-community/image-editor@2.3.0" has incorrect peer dependency "react-native@>=0.57 <0.62".
warning " > react-native-cn-richtext-editor@1.0.40" has incorrect peer dependency "react-native@^0.57.5".
warning " > react-native-cn-richtext-editor@1.0.40" has unmet peer dependency "react-native-fetch-blob@^0.10.8".
warning " > react-native-fast-image@7.0.2" has incorrect peer dependency "react-native@^0.60.0".
warning " > react-native-fs@2.16.6" has incorrect peer dependency "react-native@^0.59.5".
warning " > react-native-fs@2.16.6" has unmet peer dependency "react-native-windows@^0.57.2".
warning " > react-native-webview@10.3.2" has incorrect peer dependency "react@16.11.0".
warning " > react-native-webview@10.3.2" has incorrect peer dependency "react-native@>=0.60 <0.63".
warning " > react-native-paper@2.16.0" has unmet peer dependency "react-native-vector-icons@*".
warning "react-native-paper > create-react-context@0.2.3" has unmet peer dependency "prop-types@^15.0.0".
warning "react-native-photo-zoom > react-native@0.62.2" has incorrect peer dependency "react@16.11.0".
warning "react-navigation > react-navigation-drawer@1.4.0" has incorrect peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning "react-navigation > react-navigation-stack@1.5.3" has incorrect peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning "react-navigation > react-navigation-tabs@1.2.0" has incorrect peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning " > styled-components@4.4.1" has unmet peer dependency "react-dom@>= 16.3.0".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5".
warning "react-native > @react-native-community/cli@4.10.1" has incorrect peer dependency "react-native@^0.62.0-rc.0".
error Command failed with exit code 1.
error Command failed with exit code 1.
yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 8 new dependencies.
info Direct dependencies
└─ react-native@0.63.1
info All dependencies
├─ @babel/plugin-transform-react-jsx-self@7.10.4
├─ @react-native-community/cli-platform-android@4.10.1
├─ @react-native-community/cli-server-api@4.10.1
├─ @react-native-community/cli-types@4.10.1
├─ @react-native-community/cli@4.10.1
├─ hermes-engine@0.5.0
├─ react-devtools-core@4.8.2
└─ react-native@0.63.1
$ yarn run cjk-textinput-patch && npx jetify
yarn run v1.22.4
$ /Users/peter/App/ootd/node_modules/.bin/cjk-textinput-patch
[!] This patch is for React Native 0.62.x!
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
. Run CLI with --verbose flag for more details.
Error: Command failed: yarn add react-native@0.63.1 react@16.13.1
warning " > @react-native-community/cameraroll@1.7.2" has incorrect peer dependency "react-native@>=0.57 <=0.62".
warning " > @react-native-community/google-signin@3.0.4" has unmet peer dependency "prop-types@*".
warning " > @react-native-community/image-editor@2.3.0" has incorrect peer dependency "react-native@>=0.57 <0.62".
warning " > react-native-cn-richtext-editor@1.0.40" has incorrect peer dependency "react-native@^0.57.5".
warning " > react-native-cn-richtext-editor@1.0.40" has unmet peer dependency "react-native-fetch-blob@^0.10.8".
warning " > react-native-fast-image@7.0.2" has incorrect peer dependency "react-native@^0.60.0".
warning " > react-native-fs@2.16.6" has incorrect peer dependency "react-native@^0.59.5".
warning " > react-native-fs@2.16.6" has unmet peer dependency "react-native-windows@^0.57.2".
warning " > react-native-webview@10.3.2" has incorrect peer dependency "react@16.11.0".
warning " > react-native-webview@10.3.2" has incorrect peer dependency "react-native@>=0.60 <0.63".
warning " > react-native-paper@2.16.0" has unmet peer dependency "react-native-vector-icons@*".
warning "react-native-paper > create-react-context@0.2.3" has unmet peer dependency "prop-types@^15.0.0".
warning "react-native-photo-zoom > react-native@0.62.2" has incorrect peer dependency "react@16.11.0".
warning "react-navigation > react-navigation-drawer@1.4.0" has incorrect peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning "react-navigation > react-navigation-stack@1.5.3" has incorrect peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning "react-navigation > react-navigation-tabs@1.2.0" has incorrect peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning " > styled-components@4.4.1" has unmet peer dependency "react-dom@>= 16.3.0".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5".
warning "react-native > @react-native-community/cli@4.10.1" has incorrect peer dependency "react-native@^0.62.0-rc.0".
error Command failed with exit code 1.
error Command failed with exit code 1.
yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 8 new dependencies.
info Direct dependencies
└─ react-native@0.63.1
info All dependencies
├─ @babel/plugin-transform-react-jsx-self@7.10.4
├─ @react-native-community/cli-platform-android@4.10.1
├─ @react-native-community/cli-server-api@4.10.1
├─ @react-native-community/cli-types@4.10.1
├─ @react-native-community/cli@4.10.1
├─ hermes-engine@0.5.0
├─ react-devtools-core@4.8.2
└─ react-native@0.63.1
$ yarn run cjk-textinput-patch && npx jetify
yarn run v1.22.4
$ /Users/peter/App/ootd/node_modules/.bin/cjk-textinput-patch
[!] This patch is for React Native 0.62.x!
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

    at makeError (/Users/peter/App/ootd/node_modules/execa/index.js:174:9)
    at /Users/peter/App/ootd/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async installDeps (/Users/peter/App/ootd/node_modules/@react-native-community/cli/build/commands/upgrade/upgrade.js:208:3)
    at async Object.upgrade [as func] (/Users/peter/App/ootd/node_modules/@react-native-community/cli/build/commands/upgrade/upgrade.js:346:9)
    at async Command.handleAction (/Users/peter/App/ootd/node_modules/@react-native-community/cli/build/index.js:186:9)

-> cjk-textinput-patch -> removed after seeing this error.

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, '10.0'

target 'ootd' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  target 'ootdTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  # use_flipper!
  # post_install do |installer|
  #   flipper_post_install(installer)
  # end
end

target 'ootd-tvOS' do
  # Pods for ootd-tvOS

  target 'ootd-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end
  1. changed use_react_native!(:path => config[“reactNativePath”]) => use_react_native!(:path => config[:reactNativePath]) didn’t work.
  2. removed node_modules, yarn.lock file and reinstall didn’t work.
  3. retrying after gem update xcodeproj didn’t work.
  4. retrying after pod repo update didn’t work.

React Native version:

info Fetching system and libraries information...
System:
    OS: macOS 10.15.5
    CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
    Memory: 28.50 MB / 16.00 GB
    Shell: 3.1.2 - /usr/local/bin/fish
  Binaries:
    Node: 12.16.1 - /usr/local/bin/node
    Yarn: 1.22.4 - ~/.yarn/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.9.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2, 29.0.3
      System Images: android-25 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6514223
    Xcode: 11.6/11E708 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_241 - /usr/bin/javac
    Python: 2.7.17 - /usr/local/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.1 => 0.63.1 
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. upgrade 0.62.2 to 0.63.1
  2. pod install

Expected Results

install pod dependencies.

Snack, code example, screenshot, or link to a repository:

Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 9
  • Comments: 21

Most upvoted comments

Removing react-native-cli not working in my case. Error : Searching for inspections failed: undefined method map’ for nil:NilClass while doing ‘pod install’`

I just removed the ios and android cli from my package.json and now I’m getting

[!] Invalid `Podfile` file: cannot load such file -- /Users/shawn/app/mobile/node_modules/@react-native-community/cli-platform-ios/native_modules.

faced this issue on below mentioned app setup

React 16.13.1 & RN-0.63.4 react-native-cli - 2.0.1 Mac OS - 10.5 Xcode - 12.5.1 Cocoapods - 1.12.1 yarn - 1.22.10 node - v12.18.2

finally, issue got fixed by below steps

  1. killed the metro
  2. watchman watch-del-all
  3. Removal of “@react-native-community/cli-platform-ios”: “3.0.0”
  4. yarn cache clean
  5. yarn
  6. cd ios && pod install
  7. yarn cache clean
  8. yarn add @react-native-community/cli-platform-ios@3.0.0

Thanks

Just removing @react-native-community/cli for package.json everything works good.

Same here. If your package.json file includes @react-native-community/cli* they are probably the wrong versions. Remove them from your package.json and do a fresh yarn install, then you should have the versions react-native is expecting.