gpt4 book ai didi

ruby-on-rails - 如果你想在生产模式下使用它,如何解决 "You need to add gem ' 守护进程到你的 Gemfile 的错误?

转载 作者:数据小太阳 更新时间:2023-10-29 07:18:43 24 4
gpt4 key购买 nike

我正在尝试正确使用 Capistrano 和 RVM,以便将我的 Ruby on Rails 3.2.2 应用程序部署到运行 Ubuntu 10.04 LTS 的远程机器上。我接缝解决了我之前与“Rvm - Capistrano integration on Linux Ubuntu”相关的问题。但是,在部署时我收到以下与 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)”):

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

附言:终端窗口输出:

 $ 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 开始

关于ruby-on-rails - 如果你想在生产模式下使用它,如何解决 "You need to add gem ' 守护进程到你的 Gemfile 的错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9703680/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com