gpt4 book ai didi

ruby - 类 SpecificationPolicy 的父类(super class)不匹配

转载 作者:行者123 更新时间:2023-12-02 15:45:46 25 4
gpt4 key购买 nike

我在尝试安装或升级某些 brew 软件包时遇到了 类 SpecificationPolicy 的父类(super class)不匹配 错误。

例如,更新安装 supabase CLI 时(brew install supabase/tap/supabase):

==> Installing supabase from supabase/tap
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:12: warning: already initialized constant Gem::VERSION
/Library/Ruby/Site/2.6.0/rubygems.rb:11: warning: previous definition of VERSION was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/compatibility.rb:14: warning: already initialized constant Gem::RubyGemsVersion
/Library/Ruby/Site/2.6.0/rubygems/compatibility.rb:15: warning: previous definition of RubyGemsVersion was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/compatibility.rb:18: warning: already initialized constant Gem::RbConfigPriorities
/Library/Ruby/Site/2.6.0/rubygems/compatibility.rb:18: warning: previous definition of RbConfigPriorities was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/compatibility.rb:27: warning: constant Gem::ConfigMap is deprecated
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/compatibility.rb:35: warning: constant Gem::ConfigMap is deprecated
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/defaults.rb:3: warning: already initialized constant Gem::DEFAULT_HOST
/Library/Ruby/Site/2.6.0/rubygems/defaults.rb:3: warning: previous definition of DEFAULT_HOST was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:117: warning: already initialized constant Gem::RUBYGEMS_DIR
/Library/Ruby/Site/2.6.0/rubygems.rb:115: warning: previous definition of RUBYGEMS_DIR was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:122: warning: already initialized constant Gem::WIN_PATTERNS
/Library/Ruby/Site/2.6.0/rubygems.rb:129: warning: previous definition of WIN_PATTERNS was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:131: warning: already initialized constant Gem::GEM_DEP_FILES
/Library/Ruby/Site/2.6.0/rubygems.rb:138: warning: previous definition of GEM_DEP_FILES was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:141: warning: already initialized constant Gem::REPOSITORY_SUBDIRECTORIES
/Library/Ruby/Site/2.6.0/rubygems.rb:148: warning: previous definition of REPOSITORY_SUBDIRECTORIES was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:153: warning: already initialized constant Gem::REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES
/Library/Ruby/Site/2.6.0/rubygems.rb:161: warning: previous definition of REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:162: warning: already initialized constant Gem::READ_BINARY_ERRORS
/Library/Ruby/Site/2.6.0/rubygems.rb:169: warning: previous definition of READ_BINARY_ERRORS was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:172: warning: already initialized constant Gem::WRITE_BINARY_ERRORS
/Library/Ruby/Site/2.6.0/rubygems.rb:174: warning: previous definition of WRITE_BINARY_ERRORS was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:185: warning: already initialized constant Gem::LOADED_SPECS_MUTEX
/Library/Ruby/Site/2.6.0/rubygems.rb:181: warning: previous definition of LOADED_SPECS_MUTEX was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:1345: warning: already initialized constant Gem::MARSHAL_SPEC_DIR
/Library/Ruby/Site/2.6.0/rubygems.rb:1319: warning: previous definition of MARSHAL_SPEC_DIR was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/version.rb:157: warning: already initialized constant Gem::Version::VERSION_PATTERN
/Library/Ruby/Site/2.6.0/rubygems/version.rb:157: warning: previous definition of VERSION_PATTERN was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/version.rb:158: warning: already initialized constant Gem::Version::ANCHORED_VERSION_PATTERN
/Library/Ruby/Site/2.6.0/rubygems/version.rb:158: warning: previous definition of ANCHORED_VERSION_PATTERN was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/requirement.rb:17: warning: already initialized constant Gem::Requirement::OPS
/Library/Ruby/Site/2.6.0/rubygems/requirement.rb:12: warning: previous definition of OPS was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/requirement.rb:27: warning: already initialized constant Gem::Requirement::SOURCE_SET_REQUIREMENT
/Library/Ruby/Site/2.6.0/rubygems/requirement.rb:22: warning: previous definition of SOURCE_SET_REQUIREMENT was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/requirement.rb:30: warning: already initialized constant Gem::Requirement::PATTERN_RAW
/Library/Ruby/Site/2.6.0/rubygems/requirement.rb:25: warning: previous definition of PATTERN_RAW was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/requirement.rb:35: warning: already initialized constant Gem::Requirement::PATTERN
/Library/Ruby/Site/2.6.0/rubygems/requirement.rb:30: warning: previous definition of PATTERN was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/requirement.rb:40: warning: already initialized constant Gem::Requirement::DefaultRequirement
/Library/Ruby/Site/2.6.0/rubygems/requirement.rb:35: warning: previous definition of DefaultRequirement was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/requirement.rb:314: warning: already initialized constant Gem::Version::Requirement
/Library/Ruby/Site/2.6.0/rubygems/requirement.rb:311: warning: previous definition of Requirement was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/platform.rb:198: warning: already initialized constant Gem::Platform::RUBY
/Library/Ruby/Site/2.6.0/rubygems/platform.rb:204: warning: previous definition of RUBY was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/platform.rb:204: warning: already initialized constant Gem::Platform::CURRENT
/Library/Ruby/Site/2.6.0/rubygems/platform.rb:210: warning: previous definition of CURRENT was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/stub_specification.rb:9: warning: already initialized constant Gem::StubSpecification::PREFIX
/Library/Ruby/Site/2.6.0/rubygems/stub_specification.rb:9: warning: previous definition of PREFIX was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/stub_specification.rb:12: warning: already initialized constant Gem::StubSpecification::OPEN_MODE
/Library/Ruby/Site/2.6.0/rubygems/stub_specification.rb:12: warning: previous definition of OPEN_MODE was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/stub_specification.rb:18: warning: already initialized constant Gem::StubSpecification::StubLine::NO_EXTENSIONS
/Library/Ruby/Site/2.6.0/rubygems/stub_specification.rb:18: warning: previous definition of NO_EXTENSIONS was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/stub_specification.rb:21: warning: already initialized constant Gem::StubSpecification::StubLine::REQUIRE_PATHS
/Library/Ruby/Site/2.6.0/rubygems/stub_specification.rb:21: warning: previous definition of REQUIRE_PATHS was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/stub_specification.rb:31: warning: already initialized constant Gem::StubSpecification::StubLine::REQUIRE_PATH_LIST
/Library/Ruby/Site/2.6.0/rubygems/stub_specification.rb:31: warning: previous definition of REQUIRE_PATH_LIST was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification_policy.rb:4:in `<top (required)>': superclass mismatch for class SpecificationPolicy (TypeError)
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:16:in `<top (required)>'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:1365:in `<module:Gem>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:116:in `<top (required)>'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /usr/local/Homebrew/Library/Homebrew/utils/gems.rb:47:in `setup_gem_environment!'
from /usr/local/Homebrew/Library/Homebrew/standalone/load_path.rb:13:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/startup.rb:6:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/startup.rb:6:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/global.rb:4:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/global.rb:4:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/build.rb:11:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/build.rb:11:in `<main>'
Error: Failure while executing; `/usr/bin/sandbox-exec -f /private/tmp/homebrew20221102-2820-wkxj9g.sb nice /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -W1 -- /usr/local/Homebrew/Library/Homebrew/build.rb /usr/local/Homebrew/Library/Taps/supabase/homebrew-tap/supabase.rb` exited with 1.

我注意到在不同的库 brew upgrade heroku 上执行 brew upgrade 时也会发生此错误。

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification_policy.rb:4:in `<top (required)>': superclass mismatch for class SpecificationPolicy (TypeError)
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:16:in `<top (required)>'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:1365:in `<module:Gem>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:116:in `<top (required)>'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from /usr/local/Homebrew/Library/Homebrew/utils/gems.rb:47:in `setup_gem_environment!'
from /usr/local/Homebrew/Library/Homebrew/standalone/load_path.rb:13:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/startup.rb:6:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/startup.rb:6:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/global.rb:4:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/global.rb:4:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/build.rb:11:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/build.rb:11:in `<main>'
Error: Failure while executing; `/usr/bin/sandbox-exec -f /private/tmp/homebrew20221102-5824-12bp753.sb nice /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -W1 -- /usr/local/Homebrew/Library/Homebrew/build.rb /usr/local/Homebrew/Library/Taps/heroku/homebrew-brew/Formula/heroku-node.rb` exited with 1.

我正在使用 rvm 来管理我的 ruby​​ 版本,which ruby​​ 提供 /Users/username/.rvm/rubies/ruby-3.0.0/bin/ruby .所以不确定错误日志中的“Ruby.framework/Versions/2.6”来自哪里。

似乎是 Homebrew 和 ruby​​ 之间的问题。可能与最新的 xcode 和 MacOS Ventura 更新有关(此错误的其他报告 herehere)?

有人有任何想法或解决了这个问题吗?

最佳答案

我遇到了 this ,这表明要“正确清理系统 Ruby”,可以运行:

sudo rm -rf \
/Library/Ruby/Gems/2.6.0/{build_info,cache,doc,extensions,gems} \
/Library/Ruby/Gems/2.6.0/specifications/*.gemspec \
/Library/Ruby/Site

我这样做了,重新运行上面的 brew 命令,错误消失了!

不确定到底发生了什么,也许升级 xcode 和/或 MacOS Ventura 搞乱了系统 Ruby 安装,上面的命令“清理”了它。还不清楚为什么 which ruby​​ 指向 rvm 安装的更新的 ruby​​ 版本,但通过 Homebrew 安装某些软件包似乎正在调用 Mac 的系统 Ruby (2.6.0)。 🤷

关于ruby - 类 SpecificationPolicy 的父类(super class)不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74294323/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com