【问题标题】:Resque with Redis To Go can't work as expectationResque 与 Redis To Go 无法按预期工作
【发布时间】:2011-11-22 15:44:08
【问题描述】:

我需要使用 Resque 在 Heroku 上排队我的工作。

由于我是第一次使用它,所以我按照这个网站上的说明进行操作:Resque with Redis To Go

当我运行命令时: $ rake resque:work QUEUE=*

终端显示:

rake aborted!
Please install the yajl-ruby or json gem

(See full trace by running task with --trace)

出现错误后,我已经安装了 yajl-ruby 和 json gem;但是,它没有用。

如果我忽略这个问题并输入“rails s”来启动服务器。 它显示:

/Library/Ruby/Gems/1.8/gems/resque-1.19.0/lib/resque/helpers.rb:6: Please install the yajl-ruby or json gem (RuntimeError)
from /Library/Ruby/Gems/1.8/gems/resque-1.19.0/lib/resque.rb:10:in `require'
from /Library/Ruby/Gems/1.8/gems/resque-1.19.0/lib/resque.rb:10
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler.rb:120:in `require'
from /Users/Brian/Documents/cookie-monster/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6

我猜是我的环境问题,但我不知道如何解决。

请帮帮我,谢谢!!


mikhailov 让我粘贴我的 Gemfile 和 Gemfile.lock。 这里是: 宝石文件:

source 'http://rubygems.org'

gem 'rails', '3.0.5'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'redis'
gem 'SystemTimer'

Gemfile.lock:

GEM
  remote: http://rubygems.org/
  specs:
    abstract (1.0.0)
    actionmailer (3.0.5)
      actionpack (= 3.0.5)
      mail (~> 2.2.15)
    actionpack (3.0.5)
      activemodel (= 3.0.5)
      activesupport (= 3.0.5)
      builder (~> 2.1.2)
      erubis (~> 2.6.6)
      i18n (~> 0.4)
      rack (~> 1.2.1)
      rack-mount (~> 0.6.13)
      rack-test (~> 0.5.7)
      tzinfo (~> 0.3.23)
    activemodel (3.0.5)
      activesupport (= 3.0.5)
      builder (~> 2.1.2)
      i18n (~> 0.4)
    activerecord (3.0.5)
      activemodel (= 3.0.5)
      activesupport (= 3.0.5)
      arel (~> 2.0.2)
      tzinfo (~> 0.3.23)
    activeresource (3.0.5)
      activemodel (= 3.0.5)
      activesupport (= 3.0.5)
    activesupport (3.0.5)
    arel (2.0.9)
    builder (2.1.2)
    erubis (2.6.6)
      abstract (>= 1.0.0)
    i18n (0.5.0)
    mail (2.2.15)
      activesupport (>= 2.3.6)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.16)
    polyglot (0.3.1)
    rack (1.2.2)
    rack-mount (0.6.14)
      rack (>= 1.0.0)
    rack-test (0.5.7)
      rack (>= 1.0)
    rails (3.0.5)
      actionmailer (= 3.0.5)
      actionpack (= 3.0.5)
      activerecord (= 3.0.5)
      activeresource (= 3.0.5)
      activesupport (= 3.0.5)
      bundler (~> 1.0)
      railties (= 3.0.5)
    railties (3.0.5)
      actionpack (= 3.0.5)
      activesupport (= 3.0.5)
      rake (>= 0.8.7)
      thor (~> 0.14.4)
    rake (0.9.2)
    redis (2.2.2)
    sqlite3-ruby (1.2.4)
    thor (0.14.6)
    treetop (1.4.9)
      polyglot (>= 0.3.1)
    tzinfo (0.3.25)

PLATFORMS
  ruby

DEPENDENCIES
  rails (= 3.0.5)
  redis
  sqlite3-ruby

【问题讨论】:

  • 复制粘贴你的 GemfileGemfile.lock
  • Gemfile: source 'rubygems.org' gem 'rails', '3.0.5' gem 'sqlite3-ruby', :require => 'sqlite3' gem 'redis' gem 'SystemTimer'跨度>

标签: ruby gem rake redis resque


【解决方案1】:

你仍然应该使用/尝试:

bundle exec rake resque:work QUEUE=*

【讨论】:

    【解决方案2】:

    Resque 依赖于 'json' gem,所以只需将其添加到 Gemfile 中即可:

    gem 'json'
    

    然后 Bundler 选择合适的版本来解决依赖关系

    【讨论】:

      猜你喜欢
      • 2020-07-31
      • 2017-09-19
      • 1970-01-01
      • 1970-01-01
      • 2021-11-08
      • 2015-05-03
      • 2013-12-07
      • 2013-12-23
      • 2014-12-09
      相关资源
      最近更新 更多