![](/img/trans.png)
[英]Can't deploy rails4 project with capistrano. rbenv: version `2.0.0' is not installed
[英]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.