react-native: error: warn Multiple Podfiles were found when trying to init react-native project in mac os

Description

At first, when I tried to init a react-native project, “ruby version 2.5.7” error was shown.

I updated ruby successfully to the required version using the guide and rbenv

Now, when I am trying to create a new project I am getting multiple pod file errors.

Version

0.70.6

Output of npx react-native info

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

Steps to reproduce

I updated ruby successfully to the required version using the guide and benv

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

Error image

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 18
  • Comments: 40 (11 by maintainers)

Most upvoted comments

There is a section on the docs that suggests:

Go to the Locations panel and install the tools by selecting the most recent version in the Command Line Tools dropdown.

What happen to me is that I went there and I saw the version (only one in my case) and I assume it was selected already but you need to clicked and make sure it get selected by having a version under the select as the image below:

CleanShot 2023-01-31 at 11 07 01@2x

At least that worked for me. Also if you don’t know how to open this panel just press CMD + , ✌️

Running gem uninstall cocoapods and gem install cocoapods helped me.

Screenshot 2023-03-07 at 8 46 13 PM

Hi there!

The warning about multiple Podfile should not stop you from building the app. However, I put up a PR to fix this for new apps.

Probably, the problem is a misconfiguration of the environment. To make sure of it, could you try to manually install the pods by (from a Terminal):

  1. navigate to your app folder
  2. cd ios
  3. bundle install (you need to run this only once)
  4. bundle exec pod install This should give us a better diagnostic of your problem.

Thank you so much.

I was able to solve this issue by performing the following steps:

  1. Updated ruby successfully to the required version using the guide and rbenv.
  2. Installed the latest Xcode from Appstore.
  3. Done this setting.

If you are concerned about the multiple podfile warning:

  1. We already fixed and it will be removed in the next version of RN
  2. It is just a warning: it won’t prevent you from creating an app. If pod install is failing, the problem is somewhere else, not in the warning.

TLTR; In my case the issue was with Pod having old repo db, fixed with pod repo update and then bundle exec pod install.


I found out this after doing a manual pod install:

$ cd ios/
$ bundle exec pod install

warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/3.0.0/gems/cocoapods-core-1.12.1/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
Framework build type is static library
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `hermes-engine` from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`
[!] CocoaPods could not find compatible versions for pod "FlipperKit/FlipperKitLayoutPlugin":
  In Podfile:
    FlipperKit/FlipperKitLayoutPlugin (= 0.125.0)

None of your spec sources contain a spec satisfying the dependency: `FlipperKit/FlipperKitLayoutPlugin (= 0.125.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Hi @amypellegrini! Yes, you can create a new React Native app with npx react-Native unit <AppName> --skip-install.

This creates a new app from the React Native template, without installing any dependencies.

Which means that you have to run yarn install manually, but it will skip the iOS setup.

@cipolleschi Thank for you reply, I realize that, and running the command does fix the issue. However I’m working off the following repo, https://github.com/thecodingmachine/react-native-boilerplate/issues/344 and trying to understand why this error occurs. There must be an incorrect version listed somewhere for cocopods or something 🤷‍♀️

Exact same issue