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

Ruby 2.6.1环境下Capistrano部署失败,Bundler兼容问题求助

解决Ruby 2.6.1 + Capistrano部署Bundler版本冲突问题

1. 安装Ruby 2.6.1兼容的Bundler版本

直接执行错误提示中的命令,安装对应版本:

gem install bundler -v 2.4.22

本地和部署服务器都需要执行此操作。

2. 锁定项目的Bundler版本

  • 在项目根目录用指定版本的Bundler执行安装,更新Gemfile.lock的版本记录:
bundle _2.4.22_ install
  • 可选:在Gemfile中明确指定Bundler版本,避免后续误升级:
gem 'bundler', '~> 2.4.22'

3. 配置Capistrano使用指定版本

修改Capistrano部署配置文件(通常是config/deploy.rb),添加以下配置强制使用目标版本:

set :bundle_version, '2.4.22'

若你的Capistrano版本较旧,改用bundle_args指定:

set :bundle_args, '--deployment --quiet --binstubs --without development test --bundler-version 2.4.22'

4. 清理服务器上的不兼容版本(可选)

如果服务器存在高版本Bundler干扰,卸载它们:

gem uninstall bundler -v '> 2.4.22'

验证部署

重新执行Capistrano部署命令即可:

cap production deploy

内容的提问来源于stack exchange,提问作者Crni Mrki

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.28 19:12:12