ruby 2.x 安装 bundler /alo7/ellis

安装 bundler 包管理工具
更新于: 2025-01-17 13:21:00

安装

$ p gem install bundler
Fetching: bundler-2.6.3.gem (100%)
ERROR:  Error installing bundler:
        bundler requires Ruby version >= 3.1.0.

debug 安装

$ p gem install bundler --verbose
Getting SRV record failed: DNS result has no information for _rubygems._tcp.mirrors.aliyun.com
HEAD https://mirrors.aliyun.com/rubygems/api/v1/dependencies
404 Not Found
GET https://mirrors.aliyun.com/rubygems/prerelease_specs.4.8.gz
200 OK
GET https://mirrors.aliyun.com/rubygems/specs.4.8.gz
200 OK
Getting SRV record failed: DNS result has no information for _rubygems._tcp.mirrors.cloud.tencent.com
HEAD https://mirrors.cloud.tencent.com/rubygems/api/v1/dependencies
404 Not Found
GET https://mirrors.cloud.tencent.com/rubygems/prerelease_specs.4.8.gz
200 OK
GET https://mirrors.cloud.tencent.com/rubygems/specs.4.8.gz
200 OK
HEAD https://api.rubygems.org/api/v1/dependencies
404 Not Found
GET https://api.rubygems.org/prerelease_specs.4.8.gz
200 OK
GET https://api.rubygems.org/specs.4.8.gz
200 OK
ERROR:  Error installing bundler:
        bundler requires Ruby version >= 3.1.0.

解决方案

这里的具体版本,根据项目里的 bundle 来定。

根据项目里的版本来定具体要安装哪一个
gem install bundler -v 1.17.3

❯ p gem install bundler -v 1.17.3
Fetching: bundler-1.17.3.gem (100%)
rbenv: cannot rehash: /Users/ap7/.rbenv/shims/.rbenv-shim exists
Successfully installed bundler-1.17.3
1 gem installed