1

I'm getting the following error while trying to deploy:migrate with Capistrano:

[err :: 127.0.0.1 ] /home/synapse/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:388:in `bin_path': can't find gem rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)

Before that I was getting rake not found' error but it was gone after I added "set :rake" to deploy.rb. Ruby is installed via RVM and rake gem is of course installed.

synapse
  • 5,588
  • 6
  • 35
  • 65

1 Answers1

4

for capistrano you need to add extensions for rvm

set :rvm_ruby, "ruby-1.9.2-p180"
set :rvm_gem_home, "#{fetch(:base_dir)}/.rvm/gems/#{fetch(:rvm_ruby)}"
set :rvm_ruby_path, "#{fetch(:base_dir)}/.rvm/rubies/#{fetch(:rvm_ruby)}"
set :default_environment, {
  'RUBY_VERSION' => fetch(:rvm_ruby),
  'GEM_HOME' => "#{fetch(:rvm_gem_home)}:#{fetch(:rvm_gem_home)}@global",
  'BUNDLE_PATH' => fetch(:rvm_gem_home),
  'PATH' => "#{fetch(:rvm_gem_home)}/bin:#{fetch(:rvm_gem_home)}@global/bin:#{fetch(:rvm_ruby_path)}/bin:/home/rails/.rvm/bin:$PATH;",
}
Matt
  • 74,352
  • 26
  • 153
  • 180
Valdis
  • 3,170
  • 2
  • 18
  • 24
  • 1
    Brilliant, helped me fix a similar can't find gem rake ([">= 0"]) problem. Thanks! – Mason Mar 19 '11 at 12:30
  • 1
    Getting a "Capistrano/configuration/variables.rb:82:in `block in fetch': `base_dir' not found (IndexError)". Any ideas? – thoughtpunch May 20 '12 at 22:24