user938363
user938363

Reputation: 10378

capistrano deploy error on ubuntu - Could not find bundler

Here is the output of executing of deploy.rb with cap deploy, on ubuntu & rvm:

when executing .../bin/bundle install vendor/gem, the error comes:

  * executing "cd /vol/www/emclab/current && /home/dtt/.rvm/gems/ruby-1.9.2-p290/bin/bundle install vendor/gems"
    servers: ["12.34.56.78"]
    [12.34.56.78] executing command
*** [err :: 12.34.56.78] /home/dtt/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
*** [err :: 12.34.56.78] from /home/dtt/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
*** [err :: 12.34.56.78] from /home/dtt/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
*** [err :: 12.34.56.78] from /home/dtt/.rvm/gems/ruby-1.9.2-p290/bin/bundle:18:in `<main>'
    command finished in 624ms
failed: "sh -c 'cd /vol/www/emclab/current && /home/dtt/.rvm/gems/ruby-1.9.2-p290/bin/bundle install vendor/gems'" on 12.34.56.78

Here is the output of cap invoke COMMAND='which bundle':

 ** [out :: 12.34.56.78] /usr/local/bin/bundle

Here is the deploy.rb:

set :application, "myapp"
set :repository,  "git://github.com/myapp/myapp.git"
set :scm, :git
set :user, "dtt"
set :use_sudo, true
set :scm_passphrase, "phrase"
set :branch, "master"
set :deploy_to, "/vol/www/#{application}"
#set :deploy_via, :remote_cache

# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`

server "12.34.56.78", :web, :app, :db, :primary => true
#role :web, "your web-server here"                          # Your HTTP server, Apache/etc
#role :app, "your app-server here"                          # This may be the same as your `Web` server
#role :db,  "your primary db-server here", :primary => true # This is where Rails migrations will run
#role :db,  "your slave db-server here"

# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts

after "deploy", "deploy:bundle_gems"
after "deploy:bundle_gems", "deploy:restart"
# If you are using Passenger mod_rails uncomment this:
 namespace :deploy do
   task :bundle_gems do
     run "cd #{deploy_to}/current && /home/dtt/.rvm/gems/ruby-1.9.2-p290/bin/bundle install vendor/gems"
   end
   task :start do ; end
   task :stop do ; end
   task :restart, :roles => :app, :except => { :no_release => true } do
     run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
   end
 end

Any suggestions about the error? Thanks.

Upvotes: 1

Views: 1888

Answers (3)

Diego Plentz
Diego Plentz

Reputation: 7220

The problem may be that you need to create the bundler wrapper. You can do that this way(in your deploy.rb, for example)

require "rvm/capistrano" # http://beginrescueend.com/integration/capistrano/

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

namespace :rvm do
  task :create_bundle_wrapper, roles: :app do
    run "rvm wrapper #{rvm_ruby_string} bundle bundle"
  end  
end

after "deploy:create_symlink", "rvm:create_bundle_wrapper"

Upvotes: 0

Jonathan Julian
Jonathan Julian

Reputation: 12272

Get cap to connect and tell you where bundle is installed

cap invoke COMMAND='which bundle'

If the bundle command is not found, your PATH is not set correctly. You might need to PermitUserEnvironment in the sshd running on that host. Then you can set the path manually in the deploy user's .ssh/environment file.

Upvotes: 2

topek
topek

Reputation: 18979

Is bundler installed on the remote machine?

Somewhere in your log it says:

Could not find bundler (>= 0)

Upvotes: 1

Related Questions