You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Bundler 2.4及以上版本在M1 Mac上无法安装sorbet-static的问题求助

Bundler 2.4及以上版本在M1 Mac上无法安装sorbet-static的问题求助

大家好,我遇到了一个棘手的问题,想请各位帮忙分析下:在macOS上使用Bundler 2.4或更高版本时,安装sorbet会出现依赖解析失败的情况,但在Docker环境里不管用哪个版本的Bundler都能正常工作。

Bundler 2.3版本下正常工作的流程

  • 首先使用MRI Ruby,比如我用的是asdf local ruby 3.1.6,Ruby 3.2也会遇到同样问题(因为我们项目都在3.1版本,还没测试3.3)
  • 安装指定版本的Bundler:gem install bundler -v 2.3.27
  • 创建一个Gemfile,内容如下:
source 'https://rubygems.org'
gem 'sorbet', '>= 0.5.11647'
  • 这时执行bundle install会失败,错误信息是:
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Could not find gem 'sorbet-static (= 0.5.11647)' with platform 'ruby', which is required by gem 'sorbet (>= 0.5.11647)', in rubygems repository https://rubygems.org/ or installed locally.

The source contains the following gems matching 'sorbet-static (= 0.5.11647)':
  * sorbet-static-0.5.11647-aarch64-linux
  * sorbet-static-0.5.11647-java
  * sorbet-static-0.5.11647-universal-darwin
  * sorbet-static-0.5.11647-x86_64-linux
  • 接下来添加darwin平台:bundle lock --add-platform universal-darwin
  • 再次执行bundle install就成功了,输出如下:
Fetching gem metadata from https://rubygems.org/.
Using bundler 2.3.27
Fetching sorbet-static 0.5.11647 (universal-darwin)
Installing sorbet-static 0.5.11647 (universal-darwin)
Fetching sorbet 0.5.11647
Installing sorbet 0.5.11647
Bundle complete! 1 Gemfile dependency, 3 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

Bundler 2.4+版本下的异常情况

如果换成Bundler 2.4.0版本,按照上面同样的流程走到第6步时,会出现这样的错误:

Resolving dependencies...
Resolving dependencies...
Could not find gem 'sorbet-static (= 0.5.11647)' with platforms 'ruby', 'universal-darwin' in locally installed gems.

The source contains the following gems matching 'sorbet-static (= 0.5.11647)':
  * sorbet-static-0.5.11647-universal-darwin

而Bundler 2.4.22(以及2.5版本)的错误信息又不一样:

Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Resolving dependencies...
Could not find gems matching 'sorbet-static (= 0.5.11647)' valid for all resolution platforms (ruby, universal-darwin) in rubygems repository https://rubygems.org/ or installed locally.

The source contains the following gems matching 'sorbet-static (= 0.5.11647)':
  * sorbet-static-0.5.11647-aarch64-linux
  * sorbet-static-0.5.11647-java
  * sorbet-static-0.5.11647-universal-darwin
  * sorbet-static-0.5.11647-x86_64-linux

我想请教下这个问题有没有解决办法?虽然官方文档说Apple Silicon不支持,但从错误信息来看,问题好像和M1本身无关。希望能得到大家的帮助!

补充一下bundle platform的输出:

bundle platform
Your platform is: arm64-darwin-22

Your app has gems that work on these platforms:
* ruby
* universal-darwin

Your Gemfile does not specify a Ruby version requirement.

备注:内容来源于stack exchange,提问作者psmith

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 10:08:01