在尝试加载gem' sidekiq'时出错。

时间:2016-03-03 07:38:58

标签: ruby-on-rails ruby sidekiq

在使用Rails 5 beta 3的rails应用程序中,我使用sidekiq时遇到问题。我将sidekiq添加到我的gemfile中。运行bundle install,当我尝试运行服务器时,它会抛出错误:

/home/mateusz/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'sidekiq'. (Bundler::GemRequireError)

我试图从rails5分支和master安装sidekiq,但这并没有解决问题。

有什么想法吗?

修改

这是整个堆栈跟踪

/home/mateusz/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'sidekiq'. (Bundler::GemRequireError)
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
    from /home/mateusz/projects/athena-poc/config/application.rb:7:in `<top (required)>'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:88:in `require'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:88:in `block in server'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:85:in `tap'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:85:in `server'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.beta3/lib/rails/command.rb:20:in `run'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands.rb:18:in `<top (required)>'
    from /home/mateusz/projects/athena-poc/bin/rails:9:in `require'
    from /home/mateusz/projects/athena-poc/bin/rails:9:in `<top (required)>'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in `load'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in `call'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/client/command.rb:7:in `call'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/client.rb:28:in `run'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/bin/spring:49:in `<top (required)>'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/binstub.rb:11:in `load'
    from /home/mateusz/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/binstub.rb:11:in `<top (required)>'
    from /home/mateusz/projects/athena-poc/bin/spring:13:in `require'
    from /home/mateusz/projects/athena-poc/bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

整个application.rb文件:

require File.expand_path('../boot', __FILE__)

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module AthenaPoc
  class Application < Rails::Application

    config.generators do |g|
      g.test_framework :rspec,
        fixtures: true,
        view_specs: false,
        helper_specs: false,
        routing_specs: false,
        controller_specs: false,
        request_specs: false
      g.fixture_replacement :factory_girl, dir: "spec/factories"
    end

    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de

    config.autoload_paths += %W(#{config.root}/lib/athena)

    # Do not swallow errors in after_commit/after_rollback callbacks.
    config.active_record.raise_in_transactional_callbacks = true

    config.exceptions_app = self.routes
  end
end

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,虽然它正在安装宝石,但存在一些兼容性问题。在here之后,我发现将所有redis gems更新为master可以解决问题。

gem 'redis'
gem 'redis-rack', github: 'redis-store/redis-rack', branch: 'master'
gem 'redis-activesupport', github: 'redis-store/redis-activesupport', branch: 'master'
gem 'redis-actionpack', github: 'redis-store/redis-actionpack', branch: 'master'
gem 'redis-rails', github: 'redis-store/redis-rails', branch: 'master'
gem 'sidekiq'