Command not found in Capistrano

I learning how to deploy with Capistrano, but I ran into problem quickly, so here’s how I solve it:

1. rake is not found

  • solution: add this into deploy.rb
  • set :rake, ‘bundle exec rake’

2. bundle is not found

  • solution: run this using “cap shell”
  • gem install bundler

3. PATH problem, when running this in Cap shell:

cap> ruby -v
*** [err ::] sh: 1:
*** [err ::] ruby: not found

  • Solution: add this into deploy.rb
  • set :default_environment, {‘PATH’ => “/home/ubuntu/.rvm/gems/ruby-1.9.3-p327/bin:/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/bin:/home/ubuntu/.rvm/rubies/ruby-1.9.3-p327/bin:/home/ubuntu/.rvm/bin:$PATH”}
  • * you can ssh into your server and find out the path by doing “echo $PATH”