After updating Cocoapods to 1.13.0 it throws error
Asked Answered
I

6

53

I updated CocoaPods to version 1.13.0. Now, when I run pod install, it throws the following error:

conversions.rb:108:in '<class:Array>': undefined method 'deprecator' for ActiveSupport:Module (NoMethodError)

How can I fix it?

Here's the full error:

bundler: failed to load command: pod (/opt/homebrew/opt/bin/rbenv/versions/3.2.2/bin/pod)
/opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/gems/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 /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:8:in `<top (required)>'
    from <internal:/opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    from <internal:/opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/cocoapods-1.13.0/lib/cocoapods.rb:9:in `<top (required)>'
    from <internal:/opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    from <internal:/opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/cocoapods-1.13.0/bin/pod:36:in `<top (required)>'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/bin/pod:25:in `load'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/bin/pod:25:in `<top (required)>'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/cli.rb:492:in `exec'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/cli.rb:28:in `start'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.10/libexec/bundle:45:in `block in <top (required)>'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.10/libexec/bundle:33:in `<top (required)>'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/bin/bundle:25:in `load'
    from /opt/homebrew/opt/bin/rbenv/versions/3.2.2/bin/bundle:25:in `<main>'
Indigestion answered 5/10, 2023 at 10:35 Comment(2)
related? MacOS react native error bundler: failed to load command: podMarcelinomarcell
@Marcelinomarcell yes, the same issueIndigestion
S
79

This happens with the installation of CocoaPods version 1.13.0. The issue has been reported in the CocoaPods project here.

You can fix the issue by downgrading the activesupport gem to version 7.0.8. Run the following command in Terminal to begin with:

sudo gem uninstall activesupport

This may ask you to select the version to uninstall. Select the version if so.

Then install the version which works by running the following command in Terminal:

sudo gem install activesupport -v 7.0.8
Sternberg answered 5/10, 2023 at 15:18 Comment(5)
I use asdf and local gem so no need sudo gem uninstall activesupport gem install activesupport -v 7.0.8 and modify Gemfile to gem 'activesupport', '~> 7.0', '>= 7.0.8'Customhouse
I actually kind of did what both you said, so when I tried to uninstall activesupport, it throws me a dangerous warning that there are dependencies and if I'm sure to uninstall it, I didn't uninstall it, so here what I did I installed directly by sudo gem install activesupport -v 7.0.8 and THEN I executed the uninstall command sudo gem uninstall activesupport and it listed me the versions that I want to uninstall, I picked the last version. for me that is the SAFEST way.Trigonometry
I tired still facing issue in my MacBook. Getting same error while doing pod install or pod --versionOralla
@ganeshmanoj What is the activesupport version you have?Sternberg
Thanks @Danushkaherath now its working fine. I uninstalled all and reinstalled all with latest version ruby 3.2, and problem is with cocoapods activesupport coming with version 7.1.1 so changed to version 7.0.8Oralla
I
31

Looks like Cocoapods uses activesupport without specifying exact version and last release (7.1.0) has a bug.

Found workaround. Limit to last stable version of activesupport (7.0.8).

gem 'activesupport', '~> 7.0', '<= 7.0.8'
Indigestion answered 5/10, 2023 at 12:52 Comment(2)
You missed install keyword. gem install 'activesupport', '~> 7.0', '<= 7.0.8'Album
This approach to add it to gemfile for CI. But you’re rightIndigestion
M
13

Add this line to Gemfile of your project folder

gem 'activesupport', '~> 7.0.8'
  1. cd ios to navigate to the ios folder.
  2. bundle install to install Bundler
  3. bundle update activesupport to update version of active support
  4. bundle exec pod install to install the iOS dependencies managed by CocoaPods.
Manus answered 7/10, 2023 at 0:34 Comment(0)
N
8

My solution is to replace original gem 'cocoapods' with this below in Gemfile in root directory.

gem 'cocoapods', '~> 1.12'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'

Then, cd ios to enter in ios folder and run these below. And it will work like before. I am not familiar with this part. Maybe some commands are not necessary. but it worked for me.

1. bundle update
2. bundle install
3. pod repo update
4. bundle exec pod install
Nakada answered 7/10, 2023 at 6:48 Comment(1)
For a Flutter I fixed it with: 1. open Gemfile in iOS folder 2. Add: gem "cocoapods", '~> 1.12.1' gem and 'activesupport', '~> 7.0.8'Subclinical
S
6

This is a known bug and has been fixed by the cocoapods team but not released yet.

You can fix it easily by adding 1 line of code until the next release:

  1. Open /opt/homebrew/lib/ruby/gems/3.2.0/gems/cocoapods-1.13.0/lib/cocoapods.rb with the VSCode or something.

  2. Add require 'active_support' on line 7 above other 'require active_support/...`.

Demo

  1. (sudo) Save the file and run gem install cocoapods again.

💡 It's not required and related to this issue but you can also update your ruby and gem files following this link to prevent furthur errors

Statist answered 9/10, 2023 at 8:31 Comment(0)
K
3

This is fixed in cocoapods version 1.14.0. If there's no issue for you to install this version of cocoapods, best to upgrade it as it's much easier than to adjust the activesupport version.

https://github.com/CocoaPods/CocoaPods/releases/tag/1.14.0

add in gemfile:

gem 'cocoapods', '= 1.14.0'

then run bundle install

Kutz answered 28/11, 2023 at 2:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.