Skip to content

Ubuntu bundler broken due to ruby thor dependency explanation and workaround

ghost-from-the-past edited this page Apr 14, 2021 · 4 revisions

If when you run bundler you get and error saying "TypeError: superclass mismatch for class Command", this is due to the problem explained in this link https://bugs.launchpad.net/ubuntu/+source/ruby-thor/+bug/1885424

This happens for the Ubuntu and Debian distributions.The problem is in their fork of bundler not in the original upstream version at https://github.com/rubygems/rubygems

The involved files installed in your system are:

/usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/vendored_molinillo.rb

/usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/vendored_thor.rb


the following changes on the files had broken their magic...

-----------------------------------------------------------------------------

--- a/lib/bundler/vendored_molinillo.rb

+++ b/lib/bundler/vendored_molinillo.rb

@@ -1,4 +1,4 @@

# frozen_string_literal: true


module Bundler; end

-require_relative "vendor/molinillo/lib/molinillo"

+require "molinillo"


-----------------------------------------------------------------------------

--- a/lib/bundler/vendored_thor.rb

+++ b/lib/bundler/vendored_thor.rb

@@ -2,7 +2,7 @@


module Bundler

def self.require_thor_actions

- require_relative "vendor/thor/lib/thor/actions"

+ require "thor/actions"

end

end

-require_relative "vendor/thor/lib/thor"

+require "thor"

-----------------------------------------------------------------------------


you can revert the changes or copy the files from the upstream master branch https://github.com/rubygems/rubygems

Once the modifications done, the files will refer to the relative /vendor/molinillo and /vendor/thor directories that were removed in the fork of Ubuntu/Debian so you need to copy both directories from the upstream into

/usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/vendor

You can now run bundler with its magic restored :)

Clone this wiki locally