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
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
:.zshrc
"
.zprofile
xcode 14
After
i get:
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 fixAnswer in that issue helped. Try:
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.
can you try –
pod install --project-directory=ios
Create a file called
react-native.config.js
at the root level of your project with the following contents: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.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!
Make sure you enabled command line tools in Xcode.
Xcode → settings → Locations → Command line tools