找不到独角兽(> = 0)

时间:2011-10-26 07:15:39

标签: ruby-on-rails-3 capistrano unicorn

我目前正在使用capistrano来部署我的项目。但是我在下面遇到这个问题:

$ cap deploy:start

* executing `deploy:start'
  * executing " /usr/local/rvm/gems/ruby-1.9.2-p290/bin/unicorn_rails -c /app/current/config/unicorn.rb -E production -D"
    servers: ["x.x.x.x"]
    [x.x.x.x] executing command
 ** [out :: x.x.x.x] /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.**rb:247:in `to_specs': Could not find unicorn (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8]** (
 ** [out :: x.x.x.x] Gem::LoadError)
 ** [out :: x.x.x.x] from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
 ** [out :: x.x.x.x] from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
 ** [out :: x.x.x.x] from /usr/local/rvm/gems/ruby-1.9.2-p290/bin/unicorn_rails:18:in `<main>'
 ** [out :: x.x.x.x] 
    command finished in 253ms
failed: "sh -c '/usr/local/rvm/gems/ruby-1.9.2-p290/bin/unicorn_rails -c /app/current/config/unicorn.rb -E production -D'" on x.x.x.x

软件版本:

  • rails 3.1
  • 红宝石1.9.2-P290
  • ubuntu 10.04

有人可以帮忙吗?非常感谢!!

2 个答案:

答案 0 :(得分:2)

Capistrano无法找到PATH,GEM_PATH和GEM_HOME的正确变量。您应该在config/deploy.rb中设置它们,如下所示:

set :default_environment, {
  'PATH' => "/usr/local/rvm/gems/ruby-1.9.2-p290/bin:/usr/local/rvm/gems/ruby-1.9.2-p290@global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p290/bin:/usr/local/rvm/bin:$PATH",
  'RUBY_VERSION' => 'ruby 1.9.2p290',
  'GEM_HOME' => '/usr/local/rvm/gems/ruby-1.9.2-p290',
  'GEM_PATH' => '/usr/local/rvm/gems/ruby-1.9.2-p290:/usr/local/rvm/gems/ruby-1.9.2-p290@global'
}

答案 1 :(得分:0)

似乎服务器上没有安装Unicorn gem。

登录服务器并运行

which unicorn_rails

如果它没有返回任何路径,则表示它不可用。以root身份登录,然后安装它。

$ gem install unicorn