我更新了Cocoapods到1.13.0,在调用pod install
后,它抛出了一个错误:
rb:108:in 'class:Array':ActiveSupport的未定义方法'deprecator':Module(NoMethodError)*
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>'
我该如何解决?
5条答案
按热度按时间mutmk8jj1#
这种情况发生在Cocoapods安装中。
固定人,
这可能会要求您选择需要卸载的版本。选择版本。
然后安装工作版本
ilmyapht2#
看起来Cocoapods使用
activesupport
而没有指定确切的版本,并且最新版本(7.1.0)有一个bug。找到了解决办法。限制为
activesupport
(7.0.8)的最后 * 稳定 * 版本。o0lyfsai3#
将此行添加到项目文件夹的Gemfile中
cd ios
导航到ios文件夹。bundle install
安装Bundlerbundle update activesupport
更新活动支持的版本bundle exec pod install
安装CocoaPods管理的iOS依赖。2guxujil4#
我的解决方案是在根目录的Gemfile中将原始的
gem 'cocoapods'
替换为下面的这个。然后,
cd ios
进入ios文件夹,并运行下面这些。它会像以前一样工作。我对这部分不熟悉。也许有些命令是不必要的。但对我很有效kognpnkq5#
这是一个known bug,cocoapods团队已经将其升级为fixed,但尚未发布。
您可以通过添加1行代码轻松修复它,直到下一个版本:
1.用VSCode或其他东西打开
/opt/homebrew/lib/ruby/gems/3.2.0/gems/cocoapods-1.13.0/lib/cocoapods.rb
。1.在第7行添加
require 'active_support'
,位于其他“require active_support/...”上方。1.(sudo)保存文件并再次运行
gem install cocoapods
。这不是必需的,与此问题有关,但您也可以更新ruby和gem文件following this link以防止进一步的错误