如果你想使用它,如何解决“你需要为你的Gemfile添加gem’守护进程’”生产模式错误?

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

... * executing "cd /srv/www//releases/20120314135318 && bundle install" servers: [""] [] executing command [] rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.3-p125' -c 'cd /srv/www//releases/20120314135318 && bundle install' ** [out :: ] Using rake (0.9.2.2) ** [out :: ] Using builder (3.0.0) ... ** [out :: ] Using daemons (1.1.8) ** [out :: ] Using delayed_job (3.0.1) ** [out :: ] Using delayed_job_active_record (0.3.2) ... ** [out :: ] Your bundle is complete! It was installed into /srv/www//shared/bundle ... [] executing command [] rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.3-p125' -c 'cd /srv/www//current; RAILS_ENV=production script/delayed_job stop' *** [err :: ] /usr/local/rvm/gems/ruby-1.9.3-p125/gems/delayed_job-3.0.1/lib/delayed/command.rb:4:in `rescue in ' *** [err :: ] : *** [err :: ] You need to add gem 'daemons' to your Gemfile if you wish to use it. *** [err :: ] ( *** [err :: ] RuntimeError *** [err :: ] ) *** [err :: ] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/delayed_job-3.0.1/lib/delayed/command.rb:1:in `' *** [err :: ] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require' *** [err :: ] 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 :: ] 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 :: ] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require' *** [err :: ] from script/delayed_job:4:in `' 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//releases && tar xzf /tmp/20120314140345.tar.gz && rm /tmp/20120314140345.tar.gz'" on  

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

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

那么, 问题是什么? 我怎么解决这个问题?


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

 $:.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' ... 

PS :终端窗口输出:

  $ 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 

使用bundler运行脚本/ delayed_job: bundle exec script/delayed_job start