【问题标题】:Could not find unicorn (>= 0) amongst在其中找不到独角兽 (>= 0)
【发布时间】:2011-10-26 07:15:39
【问题描述】:

我目前正在使用 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

软件版本:

  • 导轨 3.1
  • ruby-1.9.2-p290
  • ubuntu 10.04

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

【问题讨论】:

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


    【解决方案1】:

    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'
    }
    

    【讨论】:

      【解决方案2】:

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

      登录服务器并运行

      which unicorn_rails
      

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

      $ gem install unicorn
      

      【讨论】:

      • 谢谢西蒙娜。是的,它确实将路径返回为 /usr/local/rvm/gems/ruby-1.9.2-p290/bin/unicorn_rails
      • 尝试直接在服务器上执行命令/usr/local/rvm/gems/ruby-1.9.2-p290/bin/unicorn_rails -c /app/current/config/unicorn.rb -E production -D,看看是否有效
      • 是的。有用。只是通过 capistrano 调用不起作用。 :(
      猜你喜欢
      • 1970-01-01
      • 2015-07-01
      • 2014-08-19
      • 1970-01-01
      • 2014-12-14
      • 2014-01-15
      • 2012-01-05
      • 2015-12-01
      • 1970-01-01
      相关资源
      最近更新 更多