Gem Load Error is: superclass must be a Class (Module given)
Hi, before of all sorry for the hassle.
I'm getting this error just after install the gem into my Rails project. Steps:
- Added the gem to the gemfile
- bundle install
- run rails
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'slack-ruby-client'. (Bundler::GemRequireError)
Gem Load Error is: superclass must be a Class (Module given)
Backtrace for gem load error is:
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/slack-ruby-client-0.7.7/lib/slack/web/api/error.rb:4:in `<module:Api>'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/slack-ruby-client-0.7.7/lib/slack/web/api/error.rb:3:in `<module:Web>'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/slack-ruby-client-0.7.7/lib/slack/web/api/error.rb:2:in `<module:Slack>'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/slack-ruby-client-0.7.7/lib/slack/web/api/error.rb:1:in `<top (required)>'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/slack-ruby-client-0.7.7/lib/slack-ruby-client.rb:21:in `require'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/slack-ruby-client-0.7.7/lib/slack-ruby-client.rb:21:in `<top (required)>'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `require'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
/Users/skozz/www/rails-application/api/config/application.rb:16:in `<top (required)>'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:141:in `require'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:141:in `require_application_and_environment!'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:67:in `console'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Bundler Error Backtrace:
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
from /Users/skozz/www/rails-application/api/config/application.rb:16:in `<top (required)>'
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:141:in `require'
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:141:in `require_application_and_environment!'
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:67:in `console'
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/skozz/.rvm/gems/ruby-2.1.7@rails-project/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Ruby 2.1.7 Rails 4.2.7
Someone have any idea?
Update: changing class Error < ::Faraday::Error by class Error inside of the gem now I can run my rails app and continuing developing my slack bot, but of course is not the best way.
Do you have some global class Error somewhere? Any references to Faraday::Error? Any monkey patches? Faraday::Error is definitely a class (see https://github.com/lostisland/faraday/blob/master/lib/faraday/error.rb), so it looks like it thinks Faraday::Error is a module?
@dblock makes sense. It's a big rails project, let me check the code and I'll back with the answer. Thank you!
@skozz I see this is an old issue, but just wanted to note that the root cause is likely due to the fact that Faraday::Error used to be defined as a module, but it was changed in lostisland/faraday#204 to become a class in starting with version 0.9.0.
You need to make sure you're using a version of Faraday newer than 0.9.0 to make this work.