skip to Main Content

I tried to create new React Native project and it failed due to error of multiple podfiles were found.

error: warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md

5

Answers


  1. Same here, below some more details to help solving issue.
    Fresh new Macbook Pro (M1 Pro) and after following installation steps from rn docs. Same error when init newest version, also same with 0.69.0 npx react-native init AwesomeProject:

    ✖ Installing CocoaPods dependencies (this may take a few minutes)
    error warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
    
    ✖ Installing CocoaPods dependencies (this may take a few minutes)
    error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
    

    .zshrc

    export PATH=/opt/homebrew/bin:$PATH
    eval "$(rbenv init - zsh)
    

    "

    .zprofile

    eval "$(/opt/homebrew/bin/brew shellenv)"
    export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
    export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
    export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
    

    xcode 14

    After

     ruby --version
     brew info cocoapods
    

    i get:

        ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [arm64-darwin21]
        /opt/homebrew/Cellar/cocoapods/1.11.3
    

    I don’t understand why its creating new folder with ruby cocoapods inside my rn project: /vendor
    Never had that issue on my older M1. I already tried with sudo arch -x86_64 gem install ffi

    EDIT 1: pod install --project-directory=ios shows me error similar to another cocoaPods issue but didnt fix

    Answer in that issue helped. Try:

    sudo xcode-select --switch /Applications/Xcode.app
    

    It fixed my errors and allowed me to build 0.70.3 rn init.
    But before that i’ve also downgrade my xcode to 13.4, not sure if it was necessary.

    But still i get this strange /vendor folder in my rn app, but after deleting it its still building fine on ios.

    Login or Signup to reply.
  2. can you try – pod install --project-directory=ios

    Login or Signup to reply.
  3. Create a file called react-native.config.js at the root level of your project with the following contents:

    module.exports = {
        project: {
            ios: {
                sourceDir: './ios',
            },
        },
    };
    

    Then when you run npx react-native run-ios the Podfile in the ios/ directory will by chosen and you won’t see the error.

    Login or Signup to reply.
  4. Maybe this is just me but this was my experience and fix:

    First when I ran xcode-select -p it was returning /Library/Developer/CommandLineTools

    However this looked odd as another an answer here seemed to suggest that maybe this was causing an issue. It ended up that I just hadn’t set my CLI tools correctly as described in the react native docs. Since it only had one option in the dropdown I assumed that the CLI tools were already set. However when I went back and specifically clicked on the one option, it made changes to my system.

    Now running xcode-select -p returns

    /Application/Xcode.app/Contents/Developer

    TL;DR : Open Xcode, go to ‘Settings…’ in the menu bar. Then go to the ‘Locations’ tab and click on the ‘Command Line Tools’ dropdown and click on the latest version (click on a version even if it seems like a version is already set). Now try your pod install again!

    Login or Signup to reply.
  5. Make sure you enabled command line tools in Xcode.
    Xcode → settings → Locations → Command line tools

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search