react-native: [FIXED] `error bundler: failed to load command: pod`, `deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator`

Description

I tried creating a new project in react native:

npx react-native@latest init myApp

When creating the project I get this:

Installing CocoaPods dependencies (this may take a few minutes)
error bundler: failed to load command: pod (/Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/bin/pod)
/Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:108:in `<class:Array>': undefined method `deprecator' for ActiveSupport:Module (NoMethodError)

  deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator
                                                          ^^^^^^^^^^^
Did you mean?  deprecate_constant
    from /Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:8:in `<top (required)>'
    from <internal:/Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
    from <internal:/Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
    from /Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/gems/cocoapods-1.13.0/lib/cocoapods.rb:9:in `<top (required)>'
    from <internal:/Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
    from <internal:/Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
    from /Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/gems/cocoapods-1.13.0/bin/pod:36:in `<top (required)>'
    from /Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/bin/pod:25:in `load'
    from /Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/bin/pod:25:in `<top (required)>'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:492:in `exec'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:28:in `start'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.20/exe/bundle:37:in `block in <top (required)>'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.20/exe/bundle:29:in `<top (required)>'
    from /Users/nameUser/.rbenv/versions/3.2.2/bin/bundle:25:in `load'
    from /Users/nameUser/.rbenv/versions/3.2.2/bin/bundle:25:in `<main>'
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/environment-setup?os=macos&platform=android and follow the React Native CLI QuickStart guide for macOS and iOS.
  "dependencies": {
    "react": "18.2.0",
    "react-native": "0.72.5"
  }

React Native Version

0.72.5

Output of npx react-native info

System:
  OS: macOS 14.0
  CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
  Memory: 2.95 GB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.1
    path: ~/.nvm/versions/node/v18.17.1/bin/node
  Yarn:
    version: 1.22.4
    path: /usr/local/bin/yarn
  npm:
    version: 9.6.7
    path: ~/.nvm/versions/node/v18.17.1/bin/npm
  Watchman:
    version: 2023.09.04.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.13.0
    path: /Users/nameUser/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: 15.0/15A240d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.1
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/nameUser/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Steps to reproduce

I tried creating a new project in react native:

npx react-native@latest init myApp

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Reactions: 3
  • Comments: 26 (8 by maintainers)

Commits related to this issue

Most upvoted comments

The problem appears to be that CocoaPods isn’t using an exact version of the activesupport gem and while it needs 7.0.8 it’s pulling in 7.1.0 which breaks things. A workaround I found is to update the Gemfile in the root with the following: gem 'activesupport', '~> 7.0', '<= 7.0.8'

Then run bundle update --bundler in the root then bundle install and bundle exec pod install in the ios directory and everything should work.

Yeah, so… Unfortunately, Active Support released version 7.1.0 this morning, which is not compatible with Cocoapods. I already pushed a fix on main: https://github.com/facebook/react-native/commit/ce39931bc2b02f13cbc5751ba4d4a6dbc07bc91a The release crew is aware of that and they are working to release all the supported versions with the fix:

  • 0.70
  • 0.71
  • 0.72
  • 0.73.0-RC.2

Meanwhile, you can:

  • apply the changes shown in the commit above to your local Gemfile
  • run bundle install again to pull the right version of ActiveSupport (this is needed only once)
  • run bundle exec pod install to reinstall the pods.

I’m sorry for the inconvenience and thank you for your patience!

@kyadalu1

  • add gem 'activesupport', '>= 6.1.7.3', '< 7.1.0' to Gemfile.
  • delete Gemfile.lock.
  • run cd ios && bundle install && cd ...
  • run npx pod-install

@Prabhat1933 which version of React Native are you using? And what command have you issued?

Please try:

  • navigate to your project root
  • rm -rf vendor/
  • rm -rf Gemfile.lock
  • cd ios
  • bundle install
  • bundle exec pod install

Anyway, the error says Gem::FilePermissionError: You don't have write permissions for the /Users/user/Documents/Awesome/vendor/bundle/ruby/3.2.0 directory so it seems a different error, and a Permission one, so probably related to your local environment.

@Prabhat1933 this is a different issue, so, please, open a new one. Let’s not pollute this issue for people looking at solution for Ruby failures.

@Prabhat1933 which version of React Native are you using? And what command have you issued?

Please try:

  • navigate to your project root
  • rm -rf vendor/
  • rm -rf Gemfile.lock
  • cd ios
  • bundle install
  • bundle exec pod install

Anyway, the error says Gem::FilePermissionError: You don't have write permissions for the /Users/user/Documents/Awesome/vendor/bundle/ruby/3.2.0 directory so it seems a different error, and a Permission one, so probably related to your local environment.

Thank u so much it worked . I was Trying same step before from documentation but it was not working but this time it worked

Resolved — please upgrade to react-native@0.72.6

We’ve shipped a fix for this bug as part of the latest React Native 0.72 patch release: https://github.com/facebook/react-native/releases/tag/v0.72.6.

Please upgrade to this version to resume successful iOS builds!

just a quick update on this folks: patch releases for 71 and 72 are in the works as we speak. 0.70 will follow soon after.

@stephen-pearce Thanks a ton, works for us, too! Really appreciate this quick response.

@mvalbuquerque if you need to be unblocked: