Home > Mobile >  Error Installing CocoaPods dependencies when initiating new React Native project
Error Installing CocoaPods dependencies when initiating new React Native project

Time:10-22

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

CodePudding user response:

can you try - pod install --project-directory=ios

CodePudding user response:

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.

  • Related