Linked Questions

Popular Questions

Could not find RubyGem bundler only by cap

Asked by At

this my forst deployment trial for rails.

I managed to setup all dependencies in the server side

when I type

bundle exec rails console

everything works fine. I got this strange problem when I run cap deploy:migrations locally

[.com] sh -c 'cd /home//.com/releases/20120411120423 && bundle     install --gemfile /home//.com/releases/20120411120423/Gemfile --path /home//.com/shared/bundle --deployment --quiet --without development test'
** [out] /usr/lib/ruby/1.8/rubygems.rb:779:in `report_activate_error':     Could not find RubyGem bundler (>= 0) (Gem::LoadError
** [out] )
** [out] from /usr/lib/ruby/1.8/rubygems.rb:214:in `activate'
** [out] from /usr/lib/ruby/1.8/rubygems.rb:1082:in `gem'
** [out] from /home//.gems/bin/bundle:18
command finished in 539ms

when I copy the command manually and execute it in the server it works perfectly!

this is my deploy.rb file

require "bundler/capistrano"

default_run_options[:pty] = true
set :user, 'xyz'
set :domain, ''
set :application, 'xyz'

set :repository,  "#{user}@#{domain}:git/#{application}.git"
set :deploy_to, "/home/#{user}/#{domain}"
set :deploy_via, :remote_cache
set :scm, 'git'
set :branch, 'master'
set :git_shallow_clone, 1
set :scm_verbose, true
set :use_sudo, false

set :rake, "/home//.gems/bin/rake"

server domain, :app, :web
role :db, domain, :primary => true

namespace :deploy do
  task :restart do
  run "touch #{current_path}/tmp/restart.txt"


when I launch the bundle -v from cap I got the correct location!

$ cap invoke COMMAND="which bundle"



Related Questions