cocoapods报错 undefined method `deprecator‘ for ActiveSupport:Module (NoMethodError)

升级或者重装cocoapods报错

/usr/local/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 /usr/local/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:/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>'

从错误上看Cocoapods 使用activesupport 中方法找不到对应的方法

没有指定确切的版本,并且上一个版本(7.1.0)有一个错误

找到解决方法。限制为 activesupport (7.0.8) 的最新版本

gem 'activesupport', '~> 7.0', '<= 7.0.8'

这样写可能会报错,我们换个思路,直接删除activesupport库,下载旧版本

直接删除会报 因cocoapods 使用无法删除,

You have requested to uninstall the gem:
    activesupport-7.1.0

所以我们先下载旧版本

sudo gem install activesupport -v 7.0.8

查看版本:gem list

abbrev (default: 0.1.1)
activesupport (7.1.0, 7.0.8)
addressable (2.8.5)

...

删除7.1.0

sudo gem uninstall activesupport

Select gem to uninstall:
 1. activesupport-7.0.8
 2. activesupport-7.1.0
 3. All versions

输入2

再执行pods操作,发现正常使用
 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值