1
votes

I'm having a really strange issue. On my remote server (which is a Max OSX Server), I have Ruby 1.9.3 installed via RVM. When I type ruby -v, I get

ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.3.0]

When I type in which bundle, I get

/Users/moby/.rvm/gems/ruby-1.9.3-p448/bin/bundle

And if I do bundle install in my Rails project, it succeeds without any errors.

However, when I try with Capistrano via cap deploy:cold on my local machine, which SSH's into the remote machine, deployment fails with the following error:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError)

Why is it using Ruby 1.8? How do I get it to use Ruby 1.9.3 instead?

3

3 Answers

0
votes

I was able to solve the issue by doing the following:

SSH into your remote server, and print out the following values:

$PATH
$RUBY_VERSION
$GEM_HOME
$GEM_PATH
$BUNDLE_PATH

Add the following entry into the deploy.rb file, setting the values of each key to the respective outputs from above:

set :default_environment, {
  'PATH' => "/Users/USERNAME/.rvm/gems/ruby-1.9.3-p448/bin:/Users/USERNAME/.rvm/gems/ruby-1.9.3-p448@global/bin:/Users/USERNAME/.rvm/rubies/ruby-1.9.3-p448/bin:/Users/USERNAME/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/usr/local/git/bin",
  "RUBY_VERSION" => "ruby 1.9.3",
  "GEM_HOME" => "/Users/USERNAME/.rvm/gems/ruby-1.9.3-p448",
  "GEM_PATH" => "/Users/USERNAME/.rvm/gems/ruby-1.9.3-p448:/Users/OraServer1Admin/.rvm/gems/ruby-1.9.3-p448@global",
  "BUNDLE_PATH" => "/Users/USERNAME/.rvm/gems/ruby-1.9.3-p448/bin/bundle"
}
0
votes

This post has a couple of valid solutions for your question:

How do I configure capistrano to use my rvm version of Ruby

0
votes

sudo update-alternatives --config gem

and select the right version