Search code examples
rubyrubygemsbundlerchef-infraknife

chef/knife (ruby) error: superclass mismatch for class Edit (TypeError)


i am using bundler to handle ruby gems dependencies. i require the gems using bundler programatically.

when i try to invoke knife programatically, which its dependency is specified within the Gemfile i get en error. i execute knife as follows:

Chef::Knife.run ["-v"] #invoking knife

and it returns the following error:

/var/lib/gems/2.0.0/gems/chef-11.6.2/lib/chef/knife/edit.rb:5:in `<class:Knife>': superclass mismatch for class Edit (TypeError)

i am familiar with Ruby on Rails 3 : "superclass mismatch for class ..." and the reason this occurs. but there is nothing i do which coincide with the explanation within the aforementioned stackoverflow post.

can somebody shed the light on the issue and a resolution for it?


Solution

  • I think this Edit class is creating the issue, and uninstalling knife-essentials gem will solve your problem.

    Try it once:

    gem uninstall knife-essentials