run-ios fails if CocoaPods is installed but not in the Gemfile of the current project
Description
% yarn ios --simulator 'iPhone 15 Pro'
warn Multiple Podfiles were found: ios/Podfile,macos/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/main/docs/configuration.md
✖ Installing CocoaPods dependencies (this may take a few minutes)
error bundler: failed to load command: pod (~/.gem/bin/pod)
/opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/rubygems_integration.rb:308:in `block in replace_bin_path': can't find executable pod for gem cocoapods. cocoapods is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/rubygems_integration.rb:336:in `block in replace_bin_path'
from ~/.gem/bin/pod:25:in `<top (required)>'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/cli.rb:492:in `exec'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/cli.rb:28:in `start'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/gems/3.2.0/gems/bundler-2.4.10/exe/bundle:45:in `block in <top (required)>'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/gems/3.2.0/gems/bundler-2.4.10/exe/bundle:33:in `<top (required)>'
from ~/.gem/bin/bundle:25:in `load'
from ~/.gem/bin/bundle:25:in `<main>'
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Something when wrong while installing CocoaPods. Please run pod install manually.
Reproducible Demo
Using react-native-test-app
npm run set-react-version 0.73 -- --core-only
yarn
cd example
rm ios/Podfile.lock
pod install --project-directory=ios
yarn ios
upgraded to 0.73
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Something when wrong while installing CocoaPods. Please run pod install manually.
Without further details.
I have removed installPodsAutomaticalles: true from react-native.config.js and it started working, but cannot confirm this is the solution as it was amongst other changes.
Second that.
For me it was
% npx react-native run-ios
✖ Installing CocoaPods dependencies (this may take a few minutes)
error /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/definition.rb:524:in `materialize': Could not find cocoapods-1.14.3, activesupport-7.0.8, addressable-2.8.5, claide-1.1.0, cocoapods-core-1.14.3, cocoapods-deintegrate-1.0.5, cocoapods-downloader-2.1, cocoapods-plugins-1.0.0, cocoapods-search-1.0.1, cocoapods-trunk-1.6.0, cocoapods-try-1.2.0, colored2-3.1.2, escape-0.0.4, fourflusher-2.3.1, gh_inspector-1.1.3, molinillo-0.8.0, nap-1.1.0, ruby-macho-2.5.1, xcodeproj-1.23.0, concurrent-ruby-1.2.2, i18n-1.14.1, minitest-5.20.0, tzinfo-2.0.6, public_suffix-4.0.7, algoliasearch-1.27.5, fuzzy_match-2.0.4, netrc-0.11.0, typhoeus-1.4.1, CFPropertyList-3.0.6, atomos-0.1.3, nanaimo-0.3.0, rexml-3.2.6, httpclient-2.8.3, ethon-0.16.0, ffi-1.16.3 in locally installed gems (Bundler::GemNotFound)
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/definition.rb:197:in `specs'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/definition.rb:254:in `specs_for'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/runtime.rb:18:in `setup'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler.rb:171:in `setup'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/setup.rb:23:in `block in <top (required)>'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/ui/shell.rb:159:in `with_level'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/ui/shell.rb:111:in `silence'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/bundler/setup.rb:23:in `<top (required)>'
from <internal:/opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/rubygems.rb:1370:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Something when wrong while installing CocoaPods. Please run pod install manually.
info Run CLI with --verbose flag for more details.
Disabling automatic Pods installation works as a workaround for me, too. Notable: I'm wondering that the property name is different here:
module.exports = {
project: {
ios: {
automaticPodsInstallation: false
}
}
}
upgraded to 0.73
✖ Installing CocoaPods dependencies (this may take a few minutes) error Something when wrong while installing CocoaPods. Please run pod install manually.Without further details.
I have removed
installPodsAutomaticalles: truefromreact-native.config.jsand it started working, but cannot confirm this is the solution as it was amongst other changes.
This Worked for me. Thanks @dimisus
I have removed
installPodsAutomaticalles: truefromreact-native.config.js
This is not a solution. You still have dependencies conflict but after u turned off installation pods auto u just don't update your pods. Eventually you'll come back to this problem. It's fine for a while. According your logs there is problem related to ruby version. As option we can set ruby env localy in our projects with rbenv
There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.
What worked for me was to cd example and bundle to actually install the dependencies from Gemfile. Afterwards yarn ios successfully installs the pods, builds and launches the app.