ubuntu上的capistrano部署错误 - 无法找到bundler

时间:2011-11-03 21:55:17

标签: ruby-on-rails ubuntu capistrano

这是在ubuntu& amp; ubuntu&amp ;;上执行带帽数据部署的deploy.rb的输出。 RVM:

执行... / bin / bundle install vendor / gem时,出现错误:

  * 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

这是cap的输出调用COMMAND ='which bundle':

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

这是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

有关错误的任何建议?感谢。

3 个答案:

答案 0 :(得分:2)

获取上限并告诉您安装捆绑包的位置

cap invoke COMMAND='which bundle'

如果未找到bundle命令,则表示PATH未正确设置。您可能需要在该主机上运行的sshd中PermitUserEnvironment。然后,您可以在部署用户的.ssh/environment文件中手动设置路径。

答案 1 :(得分:1)

远程计算机上是否安装了Bundler?

在日志的某处,它说:

Could not find bundler (>= 0)

答案 2 :(得分:0)

问题可能是您需要创建捆绑包装器。您可以这样做(例如在deploy.rb中)

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"