rails: 7.1.0 version causing the issue undefined method `deprecator' for ActiveSupport:Module (NoMethodError)

Steps to reproduce

running pod install which internally calls ruby. pod install --repo-update

Traceback (most recent call last):
	11: from /Users/xxxx/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `<main>'
	10: from /Users/xxxx/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `eval'
	 9: from /Users/xxxx/.rvm/gems/ruby-2.7.2/bin/pod:25:in `<main>'
	 8: from /Users/xxxx/.rvm/gems/ruby-2.7.2/bin/pod:25:in `load'
	 7: from /Users/xxxx/.rvm/gems/ruby-2.7.2/gems/cocoapods-1.13.0/bin/pod:36:in `<top (required)>'
	 6: from /Users/xxxx/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
	 5: from /Users/xxxx/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
	 4: from /Users/xxxx/.rvm/gems/ruby-2.7.2/gems/cocoapods-1.13.0/lib/cocoapods.rb:9:in `<top (required)>'
	 3: from /Users/xxxx/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
	 2: from /Users/xxxx/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
	 1: from /Users/xxxx/.rvm/gems/ruby-2.7.2/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:8:in `<top (required)>'
/Users/xxxx/.rvm/gems/ruby-2.7.2/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:108:in `<class:Array>': undefined method `deprecator' for ActiveSupport:Module (NoMethodError)
Did you mean?  deprecate_constant`

Expected behavior

Actual behavior

System configuration

Rails version:

Ruby version: 2.7.2

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Reactions: 17
  • Comments: 20 (5 by maintainers)

Commits related to this issue

Most upvoted comments

gem uninstall -v “7.1.0” gem install -v “7.0.8”

this is just a workaround until the cocoapod team fix the issue

If you are not in a Rails application (that already does that for you automatically), you should always require active_support beforing requiring anything else inside active_support. This is a requirement from the framework since the beginning.

See https://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support

This is an issue in CocoaPods, or any gems that requires Active Support features before requiring the active_support entrypoint.

This broke a lot of things for us in many projects. Gems were hit particularly bad since they do not have a Gemfile.lock. Are you guys going to fix this or shall we go through all the projects adding require 'active_support' wherever we want to use one of the Active Support features?

@fatkodima I just started seeing this on our CI, for some reason it still works locally. After gem install cocoapods we can no longer install with pod install

Hello,

When I try the workaround I receive the following error. Could you please help me?:

In my case I have version 7.1.1:

gem list | grep -i active activesupport (7.1.1)

sudo gem uninstall -v “7.1.1” ERROR: While executing gem … (Gem::Requirement::BadRequirementError) Illformed requirement [““7.1.1””]

  raise BadRequirementError, "Illformed requirement [#{obj.inspect}]"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/requirement.rb:107:in `parse'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/requirement.rb:139:in `block in initialize'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/requirement.rb:139:in `map!'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/requirement.rb:139:in `initialize'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/version_option.rb:56:in `new'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/version_option.rb:56:in `block in add_version_option'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/optparse/lib/optparse.rb:583:in `conv_arg'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/optparse/lib/optparse.rb:738:in `parse'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1686:in `block in parse_in_order'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1636:in `catch'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1636:in `parse_in_order'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1630:in `order!'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1739:in `permute!'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1764:in `parse!'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/command.rb:446:in `handle_options'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/command.rb:314:in `invoke_with_build_args'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/command_manager.rb:253:in `invoke_command'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/command_manager.rb:193:in `process_args'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/command_manager.rb:151:in `run'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/gem_runner.rb:52:in `run'
/usr/local/bin/gem:12:in `<main>'

I receive the same error using cocoa pods: Failed to install ‘admob-plus-cordova’: Error: Command failed with exit code 1: pod --version /usr/local/lib/ruby/gems/3.2.0/gems/activesupport-7.1.1/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 /usr/local/lib/ruby/gems/3.2.0/gems/activesupport-7.1.1/lib/active_support/core_ext/array/conversions.rb:8:in <top (required)>' from <internal:/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in require’ from internal:/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:86:in require' from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.13.0/lib/cocoapods.rb:9:in <top (required)>’ from internal:/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:86:in require' from <internal:/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in require’ from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.13.0/bin/pod:36:in <top (required)>' from /usr/local/bin/pod:25:in load’ from /usr/local/bin/pod:25:in <main>' at makeError (/Users/juanjosegarciamanzano/Downloads/Jabali/node_modules/execa/lib/error.js:60:11) at handlePromise (/Users/juanjosegarciamanzano/Downloads/Jabali/node_modules/execa/index.js:118:26) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Failed to restore plugin "admob-plus-cordova". You might need to try adding it again. Error: Error: Command failed with exit code 1: pod --version /usr/local/lib/ruby/gems/3.2.0/gems/activesupport-7.1.1/lib/active_support/core_ext/array/conversions.rb:108:in class:Array’: undefined method `deprecator’ for ActiveSupport:Module (NoMethodError)

I am seeing this exception not while using cocoapods, but rather simply from requiring active_support/testing/time_helpers (which I do in my spec_helper.rb for a project using RSpec).

Here’s a very simple reproduction:

require 'bundler/inline'

gemfile(true) do
  source 'https://rubygems.org'
  gem 'activesupport', '7.1.0'
end

require 'active_support/testing/time_helpers'

Result:

❯ ruby reproduction.rb
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Using base64 0.1.1
[... omitted similar lines ...]
Using activesupport 7.1.0
Using bundler 2.4.13
/Users/david/.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 /Users/david/.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:/Users/david/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from <internal:/Users/david/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from /Users/david/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/duration.rb:3:in `<top (required)>'
	from <internal:/Users/david/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from <internal:/Users/david/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from /Users/david/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/core_ext/time/calculations.rb:3:in `<top (required)>'
	from <internal:/Users/david/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from <internal:/Users/david/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from /Users/david/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/testing/time_helpers.rb:4:in `<top (required)>'
	from <internal:/Users/david/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from <internal:/Users/david/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from reproduction.rb:9:in `<main>'

Downgrading the active support to 7.0.8 worked