如何解决"您需要添加 gem 'daemons'如果您想使用它,请添加到您的 Gemfile 中"生产模式错误? [英] How to solve the "You need to add gem 'daemons' to your Gemfile if you wish to use it" error in production mode?

查看:78
本文介绍了如何解决"您需要添加 gem 'daemons'如果您想使用它,请添加到您的 Gemfile 中"生产模式错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试正确使用 Capistrano 和 RVM,以便将我的 Ruby on Rails 3.2.2 应用程序部署到运行 Ubuntu 10.04 LTS 的远程机器.我接缝解决了我之前与Rvm相关的问题- Linux Ubuntu 上的 Capistrano 集成".但是,在部署时,我收到与 DelayedJob gem 相关的以下错误:

I am trying to properly use Capistrano and RVM in order to deploy my Ruby on Rails 3.2.2 application to the remote machine that is running Ubuntu 10.04 LTS. It seams that I solved my previous problem related to the "Rvm - Capistrano integration on Linux Ubuntu". However, on deploying I get the following error related to the DelayedJob gem:

    ...
  * executing "cd /srv/www/<APP_NAME>/releases/20120314135318 && bundle install"
    servers: ["<DOMAIN>"]
    [<DOMAIN>] executing command
    [<DOMAIN>] rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.3-p125' -c 'cd /srv/www/<APP_NAME>/releases/20120314135318 && bundle install'     ** [out :: <DOMAIN>] Using rake (0.9.2.2)
 ** [out :: <DOMAIN>] Using builder (3.0.0)
    ...
 ** [out :: <DOMAIN>] Using daemons (1.1.8)
 ** [out :: <DOMAIN>] Using delayed_job (3.0.1)
 ** [out :: <DOMAIN>] Using delayed_job_active_record (0.3.2)
    ...
 ** [out :: <DOMAIN>] Your bundle is complete! It was installed into /srv/www/<APP_NAME>/shared/bundle
    ...
    [<DOMAIN>] executing command
    [<DOMAIN>] rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.3-p125' -c 'cd /srv/www/<APP_NAME>/current;  RAILS_ENV=production script/delayed_job stop'
*** [err :: <DOMAIN>] /usr/local/rvm/gems/ruby-1.9.3-p125/gems/delayed_job-3.0.1/lib/delayed/command.rb:4:in `rescue in <top (required)>'
*** [err :: <DOMAIN>] :
*** [err :: <DOMAIN>] You need to add gem 'daemons' to your Gemfile if you wish to use it.
*** [err :: <DOMAIN>] (
*** [err :: <DOMAIN>] RuntimeError
*** [err :: <DOMAIN>] )
*** [err :: <DOMAIN>] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/delayed_job-3.0.1/lib/delayed/command.rb:1:in `<top (required)>'
*** [err :: <DOMAIN>] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
*** [err :: <DOMAIN>] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
*** [err :: <DOMAIN>] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
*** [err :: <DOMAIN>] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
*** [err :: <DOMAIN>] from script/delayed_job:4:in `<main>'
    command finished in 7512ms
*** [deploy:update_code] rolling back
    ...

failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ruby-1.9.3-p125' -c 'cd /srv/www/<APP_NAME>/releases && tar xzf /tmp/20120314140345.tar.gz && rm /tmp/20120314140345.tar.gz'" on <DOMAIN>

即使错误解释是如果你想使用它,你需要将 gem 'daemons' 添加到你的 Gemfile 中",我已经将 daemons gem 添加到我的 Gemfile(从上面的输出你甚至可以注意到我是使用守护进程(1.1.8)"):

Even if the error explanation is "You need to add gem 'daemons' to your Gemfile if you wish to use it", I already added the daemons gem to my Gemfile (from the above output you can even note that I am "Using daemons (1.1.8)"):

...
gem 'delayed_job'
gem 'delayed_job_active_record'
gem 'daemons'
...

那么,问题是什么?我该如何解决?

在我的 deploy.rb 文件中,我有:

In my deploy.rb file I have:

$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :rvm_ruby_string, 'ruby-1.9.3-p125'
set :rvm_type, :user
require 'bundler/capistrano'
...

P.S.:终端窗口输出:

 $ ruby -v
 > ruby 1.9.3p125 (2012-02-16 revision 34643) [i686-linux]
 $ which ruby
 > /usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby

推荐答案

Run script/delayed_job with bundler:bundle exec script/delayed_job start

Run script/delayed_job with bundler: bundle exec script/delayed_job start

这篇关于如何解决&amp;quot;您需要添加 gem &amp;#39;daemons&amp;#39;如果您想使用它,请添加到您的 Gemfile 中&quot;生产模式错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆