簡體   English   中英

Capistrano 部署的 Rails 找不到已安裝的捆綁程序版本

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

我正在嘗試將項目的 Ruby 版本從 2.3.1 升級到 2.7.6。 但是 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

我安裝了正確版本的捆綁器並刪除了默認版本。 目前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)

Gemfile.lock 結束:

BUNDLED WITH
   1.17.2

我不知道在這里做什么。 我在inte.net上發現了類似的問題,但都沒有解決方案。

最終通過升級 RubyGems 解決:

gem update --system

看起來較新的 RubyGems 版本更新了捆綁器的加載方式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM