Skip to content

react-native doctor crashes when it fails to find the default Podfile #1989

@sbalay

Description

@sbalay

Environment

System:
    OS: macOS 13.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 79.91 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.14.2 - /var/folders/sl/dfwlj7fj2d52x407gqdq2trm0000gn/T/yarn--1687965785454-0.3638992685366529/node
    Yarn: 1.22.19 - /var/folders/sl/dfwlj7fj2d52x407gqdq2trm0000gn/T/yarn--1687965785454-0.3638992685366529/yarn
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
    Watchman: 2023.06.12.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /Users/sebastianbalay/.gem/ruby/3.1.2/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK:
      API Levels: 28, 30, 33
      Build Tools: 30.0.2, 30.0.3, 33.0.0
      System Images: android-28 | Google APIs ARM 64 v8a, android-33 | Google APIs ARM 64 v8a, android-33 | Google APIs Intel x86_64 Atom, android-33 | Google Play ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2022.2 AI-222.4459.24.2221.10121639
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.6 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.8 => 0.71.8
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Description

When the Podfile doesn't exist or is renamed, the doctor command crashes with the following error:

TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at Object.getDiagnostics (/Users/user/project/node_modules/@react-native-community/cli-doctor/build/tools/healthchecks/xcodeEnv.js:59:8)

Reproducible Demo

In any react-native project, rename or remove the Podfile inside the iOS folder (i.e. mv ios/Podfile ios/Podfile.backup)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions