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
- Fixed. NoMethodError: undefined method `deprecator' for ActiveSupport:Module ``` An error occurred while loading spec_helper. Failure/Error: require "active_support/core_ext/time/calculations" NoMet... — committed to sue445/rubicure by sue445 9 months ago
- require activesupport; fix for activesupport 7.1.0 The release of ActiveSupport 7.1.0 broke the cherry-picking of activesupport components. For the gory details, see https://github.com/rails/rails/is... — committed to logicly-au/csvlint.rb by deleted user 9 months ago
- Require active_support early or Rails 7.1 breaks everything See https://github.com/rails/rails/issues/49495 — committed to sul-dlss/common-accessioning by mjgiarlo 9 months ago
- Require active_support early or Rails 7.1 breaks everything See https://github.com/rails/rails/issues/49495 — committed to sul-dlss/dor-event-client by mjgiarlo 9 months ago
- Require active_support early or Rails 7.1 breaks everything See https://github.com/rails/rails/issues/49495 — committed to sul-dlss/dor-services-client by mjgiarlo 9 months ago
- Require active_support early or Rails 7.1 breaks everything See https://github.com/rails/rails/issues/49495 — committed to sul-dlss/orcid_client by mjgiarlo 9 months ago
- Fix Rails 7.1.0 enforcing active_support dep Similar to https://github.com/rails/rails/issues/49495#issuecomment-1749085658 — committed to calebhearth/title by calebhearth 8 months ago
- Try to fix an activesupport issue as per https://github.com/rails/rails/issues/49495 — committed to cheddar-me/pecorino by julik 8 months ago
- Fix dependency issue with Deprecator Running tests threw a `undefined method 'deprecator'` error. This is related to the `time_helpers` from activesupport. This issue is defined here: https://github.... — committed to alphagov/forms-api by chao-xian 8 months ago
- Fix dependency issue with Deprecator Running tests threw a `undefined method 'deprecator'` error. This is related to the `time_helpers` from activesupport. This issue is defined here: https://github.... — committed to alphagov/forms-api by chao-xian 8 months ago
- DEV: Fix incompatibility with active_support 7.1.0 See: https://github.com/rails/rails/issues/49495 — committed to discourse/mini_scheduler by CvX 8 months ago
- Fix dependency issue with Deprecator Running tests threw a `undefined method 'deprecator'` error. This is related to the `time_helpers` from activesupport. This issue is defined here: rails/rails#494... — committed to alphagov/forms-api by chao-xian 8 months ago
- DEV: Fix incompatibility with active_support 7.1.0 (#41) * DEV: Fix incompatibility with active_support 7.1.0 See: https://github.com/rails/rails/issues/49495 * AS is not a dependency of mini_s... — committed to discourse/mini_scheduler by CvX 8 months ago
- Fix dependency issue with Deprecator Running tests threw a `undefined method 'deprecator'` error. This is related to the `time_helpers` from activesupport. This issue is defined here: rails/rails#494... — committed to alphagov/forms-api by chao-xian 8 months ago
- Fix dependency issue with Deprecator Running tests threw a `undefined method 'deprecator'` error. This is related to the `time_helpers` from activesupport. This issue is defined here: rails/rails#494... — committed to alphagov/forms-api by chao-xian 8 months ago
- Fix dependency issue with Deprecator Running tests threw a `undefined method 'deprecator'` error. This is related to the `time_helpers` from activesupport. This issue is defined here: rails/rails#494... — committed to alphagov/forms-api by chao-xian 8 months ago
- Fix dependency issue with Deprecator Running tests threw a `undefined method 'deprecator'` error. This is related to the `time_helpers` from activesupport. This issue is defined here: rails/rails#494... — committed to alphagov/forms-api by chao-xian 8 months ago
- Fix dependency issue with Deprecator Running tests threw a `undefined method 'deprecator'` error. This is related to the `time_helpers` from activesupport. This issue is defined here: rails/rails#494... — committed to alphagov/forms-api by chao-xian 8 months ago
- Fix dependency issue with Deprecator Running tests threw a `undefined method 'deprecator'` error. This is related to the `time_helpers` from activesupport. This issue is defined here: rails/rails#494... — committed to alphagov/forms-api by chao-xian 8 months ago
- Fix dependency issue with Deprecator Running tests threw a `undefined method 'deprecator'` error. This is related to the `time_helpers` from activesupport. This issue is defined here: rails/rails#494... — committed to alphagov/forms-api by chao-xian 8 months ago
gem uninstall -v “7.1.0” gem install -v “7.0.8”
this is just a workaround until the cocoapod team fix the issue
You also need to add
require "active_support"
before that. See https://guides.rubyonrails.org/active_support_core_extensions.html#cherry-picking-a-definitionSo the problem is this line https://github.com/CocoaPods/CocoaPods/blob/479e71131962e3e560e4cc0601d39860c2a590ce/lib/cocoapods.rb#L9 requires a file, which then executes https://github.com/rails/rails/blob/2d271a4b901e7a7dae8ba4e5e83edfebdee278e8/activesupport/lib/active_support/core_ext/array/conversions.rb#L108, but
deprecator
is defined in https://github.com/rails/rails/blob/main/activesupport/lib/active_support/deprecator.rb which is required by https://github.com/rails/rails/blob/2d271a4b901e7a7dae8ba4e5e83edfebdee278e8/activesupport/lib/active_support.rb#L29So, I think the solution is to add
require "active_support"
right before these lines https://github.com/CocoaPods/CocoaPods/blob/479e71131962e3e560e4cc0601d39860c2a590ce/lib/cocoapods.rb#L7-L9 in thecocoapods
itself.Looks like it is fixed by https://github.com/CocoaPods/CocoaPods/pull/12082
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 insideactive_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 addingrequire '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 withpod 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””]
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:inrequire' 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:inrequire' 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 requiringactive_support/testing/time_helpers
(which I do in myspec_helper.rb
for a project using RSpec).Here’s a very simple reproduction:
Result:
Downgrading the active support to 7.0.8 worked