简体   繁体   English

Capistrano 部署的 Rails 找不到已安装的捆绑程序版本

[英]Rails deploy by Capistrano can't find installed bundler version

I am trying to upgrade Ruby version of my project from 2.3.1 to 2.7.6.我正在尝试将项目的 Ruby 版本从 2.3.1 升级到 2.7.6。 But Capistrano deployment fails with this error:但是 Capistrano 部署失败并出现以下错误:

$ cap app_name deploy
  * executing "cd /path/to/app/app_name/releases/20221005131513 && bundle install --gemfile /path/to/app/app_name/releases/20221005131513/Gemfile --path /path/to/app/app_name/shared/bundle --deployment --quiet --without development test"
*** [err :: app_name.example.com] /usr/local/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/rubygems.rb:277:in `find_spec_for_exe'
*** [err :: app_name.example.com] :
*** [err :: app_name.example.com] Could not find 'bundler' (1.17.2) required by your /path/to/app_name/releases/20221005131513/Gemfile.lock.
*** [err :: app_name.example.com] (
*** [err :: app_name.example.com] Gem::GemNotFoundException
*** [err :: app_name.example.com] )
*** [err :: app_name.example.com] 
*** [err :: app_name.example.com] To update to the latest version installed on your system, run `bundle update --bundler`.
*** [err :: app_name.example.com] To install the missing version, run `gem install bundler:1.17.2`
*** [err :: app_name.example.com] from /usr/local/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/rubygems.rb:296:in `activate_bin_path'
*** [err :: app_name.example.com] from /usr/local/rvm/rubies/ruby-2.7.6/bin/bundle:23:in `<main>'
failed: "env PATH=/usr/local/rvm/gems/ruby-2.7.6@global:/usr/local/rvm/rubies/ruby-2.7.6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin sh -c 'cd /path/to/app_name/releases/20221005131513 && bundle install --gemfile /path/to/app_name/releases/20221005131513/Gemfile --path /path/to/app_name/shared/bundle --deployment --quiet --without development test'" on app_name.example.com

I installed the right version of bundler and deleted the default one.我安装了正确版本的捆绑器并删除了默认版本。 Present state:目前state:

$ rvm use 2.7.6
Using /usr/local/rvm/gems/ruby-2.7.6
$ bundler -v
Bundler version 1.17.2
$ which bundle
/usr/local/rvm/gems/ruby-2.7.6/bin/bundle
$ gem list bundler

*** LOCAL GEMS ***

bundler (1.17.2)

End of Gemfile.lock: Gemfile.lock 结束:

BUNDLED WITH
   1.17.2

I don't know what to do here.我不知道在这里做什么。 I found similar problems on the inte.net, but none of them had a solution.我在inte.net上发现了类似的问题,但都没有解决方案。

Finally resolved by upgrading RubyGems:最终通过升级 RubyGems 解决:

gem update --system

Looks like newer RubyGems versions updated the way bundler is loaded.看起来较新的 RubyGems 版本更新了捆绑器的加载方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM