Ruby on rails 5 rvm更新后Capistrano使用错误的ruby版本

Ruby on rails 5 rvm更新后Capistrano使用错误的ruby版本,ruby-on-rails-5,capistrano,ruby-2.4,Ruby On Rails 5,Capistrano,Ruby 2.4,我有一个Capistrano3.4.0脚本,已经成功部署了一个应用程序多年。但是今天我更新了RVM,并尝试部署我的rails应用程序,我正在升级到rails 5.1.4。Capistrano在第一部分似乎工作得很好,但随后抛出了这个错误 cd /srv/www/my_app/releases/20180124210207 && ~/.rvm/bin/rvm default do bundle install --path /srv/www/my_app/shared/bundle

我有一个Capistrano3.4.0脚本,已经成功部署了一个应用程序多年。但是今天我更新了RVM,并尝试部署我的rails应用程序,我正在升级到rails 5.1.4。Capistrano在第一部分似乎工作得很好,但随后抛出了这个错误

cd /srv/www/my_app/releases/20180124210207 && ~/.rvm/bin/rvm default do bundle install --path /srv/www/my_app/shared/bundle --without development test --deployment --verbose
 DEBUG [14a8f315]   /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs'
 DEBUG [14a8f315]   : 
 DEBUG [14a8f315]   Could not find bundler (>= 0) amongst [bundler-unload-1.0.2, did_you_mean-1.1.0, executable-hooks-1.3.2, gem-wrappers-1.3.2, minitest-5.10.1, net-telnet-0.1.1, passenger-5.1.12, power_assert-0.4.1, rack-2.0.3, rake-12.0.0, rubygems-bundler-1.4.4, rvm-1.11.3.9, test-unit-3.2.3, xmlrpc-0.2.1]
 DEBUG [14a8f315]    (
 DEBUG [14a8f315]   Gem::LoadError
 DEBUG [14a8f315]   )
显然,我不想使用ruby 1.9.1,当我ssh到linux中并执行ruby-v时,它会显示ruby 2.4.1。我使用

rvm get stable
rvm install ruby 2.4.1
sudo rvm --default use 2.4.1
我也在使用capistrano rvm gem,当capistrano脚本开始它所说的部署时

 DEBUG [081254bd] Command: ~/.rvm/bin/rvm current
 DEBUG [081254bd]   ruby-2.4.1
 DEBUG [081254bd] Finished in 2.704 seconds with exit status 0 (successful).

 DEBUG [e45e0d6b] Command: ~/.rvm/bin/rvm version
 DEBUG [e45e0d6b]   rvm 1.29.3 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

为什么在部署的中途要切换到ruby 1.9.1?如何让它使用我的默认ruby版本2.4.1?

必须执行以下操作才能使其正常工作

sudo chown -R your_user /home/deployer/.rvm
gem install bundler

然后运行capistrano脚本。

你的应用程序中有
.ruby版本的
文件吗?或者在你的Gemfile顶部有一条ruby线?没有。在我的Gemfile中我有gem'rails','5.1.4'。该死的。。。我只是觉得这可能是一种不匹配。我偶尔会有一个旧的
.ruby版本
,我忘记了它。。。