Closed johan-smits closed 4 years ago
Thor 0.19 has different superclass for Command
. So if both versions are loaded you will get this error.
https://github.com/erikhuda/thor/commit/35ab20dc5400d5c3bbefdfc74a9536849e9cca4b.
bundler vendor thor with a different namespace to avoid this problem and others, so the fact debian doesn't respect that project choice is an issue in the OS, not in thor or even bundler.
@rafaelfranca thanks for the swift reply. I opened up a ticket at Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955405
@johan-smits did you find a workaround?
On Ubuntu 20.04, I ended up running:
dpkg -r --force-depends ruby-thor
gem install thor
Leaving my machine in the above state caused problems because of broken dependencies. I ended up building a .deb for thor 1.0.1 myself.
git clone https://github.com/erikhuda/thor
cd thor
gem build thor.gemspec
fpm
gem install fpm
/var/lib/gems/2.7.0/gems/fpm-1.11.0/lib/fpm/package/gem.rb
"--no-ri", "--no-rdoc"
to "--no-document"
.deb
fpm -s gem -t deb --gem-package-name-prefix ruby thor-1.0.1.gem
.deb
dpkg -i rubygem-thor_1.0.1_all.deb
@paulschreiber I did not, the project stalled for me so no need to continue. A new upload to Debian would fix it I guess. But the bugreport is not very active.
@johan-smits I filed a report on Ubuntu as well: https://bugs.launchpad.net/ubuntu/+source/ruby-thor/+bug/1885424
I added gem 'thor', '~> 0.20.3'
to my Rails app's gems.rb
(aka Gemfile
) in order to make this go away.
I turns out that using a custom installed Ruby 2.7.1, instead of the Debian Buster default 2.5.5, this error does not appear, at least with one of the two Ruby packages where I've found it.
Previously, I tried to install Thor 1.0.1, using the standard Debian package practices:
$ apt install gem2deb
$ gem2deb thor
$ sudo apt install ruby-thor_1.0.1-1_all.deb
However, it didn't change the error message:
[...]/vendor/bundle/ruby/2.5.0/gems/thor-1.0.1/lib/thor/command.rb:2:in `<class:Thor>': superclass mismatch for class Command (TypeError)
So I suspect that there is some incompatibility with thor 1.0.1 and some Ruby versions pre-2.7.1.
As others may still run into this problem:
sudo gem install bundler
helps (as long as /usr/local/bin
is in your path before /usr/bin
, this should be the default).
@richard-viney
I added
gem 'thor', '~> 0.20.3'
to my Rails app'sgems.rb
(akaGemfile
) in order to make this go away. This option really worked for me ( I added the current version: 1.1.0 ). Thanks a lot
Somehow, following the guide and using the caveat instruction for "Windows Subsystem for Linux" which advised to disable the spring
and listen
gems - e.g rails new blog --skip-spring --skip-listen
really fixed it on my Ubuntu 20.04.
As others may still run into this problem:
sudo gem install bundler
helps (as long as/usr/local/bin
is in your path before/usr/bin
, this should be the default).
update bundler from 2.4.0 to 2.4.3 to solve issue!
When I update my rails project thor from
0.20.3
to1.0.0
or1.0.1
I cannot run tests anymore. It gives me this trackback:I run on Debian testing but I have installed
ruby-bundler
which also installsruby-thor@0.19.4-1
. Not sure if this is the case but why does this break?