HelloWorld
HelloWorld

Reputation: 4349

Capistrano using wrong ruby version after rvm update

I have a capistrano 3.4.0 script that has successfully deployed an app for years. However today I updated RVM and am trying to deploy my rails app which I'm upgrading to Rails 5.1.4. Capistrano seems to work well for the first part but then throws this error...

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]   )

Obviously I don't want to use ruby 1.9.1, when I ssh into the linux both and do a ruby -v it says Ruby 2.4.1. I set that as the default by using

rvm get stable
rvm install ruby 2.4.1
sudo rvm --default use 2.4.1

I'm also using the capistrano-rvm gem, when the capistrano script begins the deployment it says

 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]

Why is it switching to ruby 1.9.1 mid way through the deployment? How do I get it to use my default ruby version of 2.4.1?

Upvotes: 2

Views: 1690

Answers (1)

HelloWorld
HelloWorld

Reputation: 4349

Had to do the following to get it working...

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

Then run capistrano script.

Upvotes: 1

Related Questions