本站资源仅用于学习交流,禁止商业运营与违法、侵权等非法行为;资源下载后请于 24 小时内删除,违规后果由使用者自行承担。
安装 bundler 报错:
ERROR: Could not find a valid gem 'bundler' (= 1.17.3), here is why:
Unable to download data from https://rubygems.org/ - Errno::ENETUNREACH: Network is unreachable - connect(2) for "api.rubygems.org" port 443 (https://api.rubygems.org/specs.4.8.gz)
1.添加国内源:
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
注意:如果之前自己瞎捣鼓已配置过源,建议先清理:
gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.com/
2.验证当前源:
gem sources -l
应该显示:
*** CURRENT SOURCES ***
https://gems.ruby-china.com/
3.安装 bundler:
gem install bundler -v 1.17.3
或离线安装(下载 .gem 文件):
gem fetch bundler -v 1.17.3
本地安装:
gem install ./bundler-1.17.3.gem
安装完成后运行:
bundle -v
应输出:
Bundler version 1.17.3
到这里环境已经安装成功!
安装依赖并启动:
cd /home/root/dldl-gm && sh restart-alpha.sh
会报错如下:
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
Fetching source index from http://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/
解决方案一:
全局配置 Bundler 使用 Ruby China 镜像(HTTPS)
bundle config set --global mirror.http://rubygems.org https://gems.ruby-china.com
bundle config set --global mirror.https://rubygems.org https://gems.ruby-china.com
验证配置:
bundle config list
应看到类似:
Settings are listed in order of priority. The top value will be used.
mirror.http://rubygems.org
Set via BUNDLE_MIRROR__HTTP://RUBYGEMS__ORG: "https://gems.ruby-china.com"
mirror.https://rubygems.org
Set via BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG: "https://gems.ruby-china.com"
这会把所有对 rubygems.org 的请求(无论 HTTP/HTTPS)都重定向到 https://gems.ruby-china.com
解决方案二:
打开:/home/root/dldl-gm/Gemfile和Gemfile.lock
把文件里面的:http://rubygems.org/ 改为 https://gems.ruby-china.com/
重新安装依赖并启动:
cd /home/root/dldl-gm && sh restart-alpha.sh
应看到类似:
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
Fetching gem metadata from https://gems.ruby-china.com/..........
Fetching rake 12.3.1
Installing rake 12.3.1
Fetching concurrent-ruby 1.0.5
恭喜您,这就是已经在正常安装依赖了!
© 版权声明
1. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需。
2. 本站提供的所有资源仅供本地单机参考学习使用,不存在任何商业目的与商业用途,请大家不要用于商用!
3.如果本站有侵犯、不妥之处的资源,请在网站右边客服联系我们。将会第一时间解决!若侵犯到您的权益,请联系站长邮箱:12225150@qq.com 我们会在24h小时之内进行删除处理。THE END


![【1.80御龍元素火龙[摸摸登陆器]】战神引擎WIN服务端+GM工具+充值后台+双端+架设教程-吾爱懒猫](https://www.52lanm.com/wp-content/uploads/2025/09/20250922070610486-Compress_Screenshot_20250922-063139.jpg)












暂无评论内容