用于rails 3.1.3的capistrano部署中的“bundle not found”

时间:2012-03-02 04:43:00

标签: ruby-on-rails deployment capistrano

以下是来自上限部署的消息部分:

 ** [out :: 176.195.225.93] /home/cj/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `
to_specs': Could not find bundler (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2,
 rdoc-3.9.4] (Gem::LoadError)
 ** [out :: 176.195.225.93] from /home/cj/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256
:in `to_spec'
 ** [out :: 176.195.225.93] from /home/cj/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
 ** [out :: 176.195.225.93] from /home/cj/.rvm/gems/ruby-1.9.3-p125/bin//bundle:18:in `<main>'
    command finished in 143ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/byop/releases/20120302043344; true"
    servers: ["176.195.225.93"]
    [176.195.225.93] executing command
    command finished in 131ms
failed: "env PATH=/home/cj/.rvm/gems/ruby-1.9.3-p125/bin/:$PATH BUNDLE_PATH=/home/cj/.rvm/gems/ruby-1.9.3-p125/bin/
 sh -c 'cd /var/www/byop/releases/20120302043344 && bundle install --gemfile /var/www/byop/releases/20120302043344/Gemfile --
path /var/www/byop/shared/bundle --deployment --quiet --without development test'" on 176.195.225.93

同一个问题有一些帖子,但没有一个解决方案有效。我们在deploy.rb中设置默认值,如:

set :default_environment, {
  'PATH' => "/home/cj/.rvm/gems/ruby-1.9.3-p125/bin/:$PATH",
  'BUNDLE_PATH'  => '/home/cj/.rvm/gems/ruby-1.9.3-p125/bin/'  
}

但是上限仍然有问题找到捆绑。

感谢任何帮助。非常感谢。

更新:

这是/ var / www / byop:

下的bundle -v的输出
Bundler version 1.0.22

1 个答案:

答案 0 :(得分: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"