Question

I installed ruby-1.9.3-p286 on my server with RVM, and confirmed it with ruby -v in the terminal.

However, following the instructions from RVM-Capistrano gem integration,

set :rvm_ruby_string,  ENV['GEM_HOME'].gsub(/.*\//,"")
require 'rvm/capistrano'

and running cap deploy, it still insists on running ruby-1.9.3-p0, and of course it can't find it.

Manually opening up irb in Terminal and running ENV['GEM_HOME'].gsub(/.*\//,"") returns ruby-1.9.3-p286, so I am puzzled why it keeps asking for ruby-1.9.3-p0.

Anyone encountered a similar situation?

Was it helpful?

Solution

I was just struggling with a similar problem, googled for a solution, and found your question. Anyway, in my case, I had specified the Ruby version to be 1.9.3-p327 everywhere: in my .bashrc file (rvm --default use 1.9.3-p327), in the application's .rvmrc file (rvm use 1.9.3-p327@my_app_name), etc., and I still got this output when commanding cap deploy or cap deploy:setup:

*** [err :: localhost] ruby-1.9.3-p286 is not installed.
 ** [out :: localhost] To install do: 'rvm install ruby-1.9.3-p286'
*** [err :: localhost] Error: RVM was unable to use '1.9.3@my_app_name'

Turns out the problem was in Capistrano's configuration file, my_app_name/config/deploy.rb. It defined the Ruby version like this:

set :rvm_ruby_string,           "1.9.3@#{application}"

Why Capistrano turned this into 1.9.3-p286 is still a mystery to me. Anyway, I added the Ruby patchlevel to the line, like this:

set :rvm_ruby_string,           "1.9.3-p327@#{application}"

And then cap deploy:setup and cap deploy started working.

Furthermore, I found out that Capistrano has added the possibility of using the Ruby version given in the application's .rvmrc file (see this), so you can just set that line to

set :rvm_ruby_string,           :local

and never have to touch it again, even if you change the Ruby version in .rvmrc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top