capistrano在[](Gem :: LoadError)中找不到bundler(> = 0)

时间:2013-01-24 18:46:45

标签: ruby-on-rails capistrano

当通过capistrano部署rails应用程序时,我收到以下错误:

[example.com] executing command
 ** [out :: example.com] /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [] (Gem::LoadError)
 ** [out :: example.com] from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
 ** [out :: example.com] from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
 ** [out :: example.com] from /usr/local/bin/bundle:22:in `<main>'
    command finished in 181ms

我将ruby安装到/ usr / local中,我没有使用像RVM这样的东西。这是我的deploy.rb:

 require 'bundler/capistrano'
load 'deploy/assets'

set :default_environment, {
  'PATH' => "/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:$PATH",
  "RUBY_VERSION" => "ruby 1.9.3",
  "GEM_HOME" => "/usr/local/lib/ruby/gems/1.9.1/gems",
  "GEM_PATH" => "/usr/local/lib/ruby/gems/1.9.1/gems",
  "BUNDLE_PATH" => "/usr/local/lib/ruby/gems/1.9.1/gems"
}

set :application, "appname"
set :repository, "git@github.com/something.git"
set :user, "thebestuserever"
set :scm_username, "somegithubaccount"
set :use_sudo, true
set :branch, "master"
ssh_options[:forward_agent] = true
default_run_options[:pty] = true

set :scm, :git
set :deploy_to, "/application/path"

role :web, "example.com"
role :app, "example.com"
role :db, "example.com", :primary => true

namespace :deploy do
  desc "Restarting mod_rails with restart.txt"
  task :restart, :roles => :app, :except => { :no_release => true } do
      run "touch #{current_path}/tmp/restart.txt"
  end

  [:start, :stop].each do |t|
      desc "#{t} task is a no-op with mod_rails"
      task t, :roles => :domain do ; end
  end
end

task :after_update_code do  
  run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
  run "cd #{release_path}; rake assets:precompile RAILS_ENV=production "
  run "cd #{release_path}; ./script/delayed_job restart"
end

我确信我只是在这里错过了一些简单的东西。但我似乎无法找到它。

1 个答案:

答案 0 :(得分:3)

我删除了set :default_environment电话。我在一个较旧的脚本中有这个,我认为它主要用于RVM而不是系统安装。摆脱它修复它。所以我猜道路以某种方式搞砸了。