You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# gem install sshkit
...
ERROR: Error installing sshkit:
There are no versions of base64 (>= 0) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?
base64 requires Ruby version >= 2.4. The current ruby version is 2.2.0.
The problem is that we have added a dependency on the base64 gem in order to support Ruby 3.4+, but the base64 gem is not available on Ruby 2.2 or older.
However, this doesn't work as intended. The RUBY_VERSION check is evaluated at gem publishing time, not at runtime. Assuming we publish the gem using a recent version of Ruby (which we do), then the gem will always have the base64 dependency, regardless of the Ruby version being used to install sshkit.
Remove the base64 dependency entirely. This will fix installation on old versions of Ruby. However people using Ruby 3.4+ will have a bad experience: they will need to manually install base64 or add it to their Gemfile, otherwise sshkit won't work.
Update sshkit to officially drop support for Ruby 2.2 and older.
I'm leaning toward dropping support for old versions of Ruby, given the fact that we have not received any bug reports from people using old versions of Ruby regarding this issue.
Edit: the last version of sshkit that seems to successfully install on Ruby 2.2 is sshkit 1.22.0.
The text was updated successfully, but these errors were encountered:
A third potential option is to write our own base64 implementation to eliminate the gem dependency.
However, this will give us only a short reprieve, since logger is being removed as a built-in gem in future versions of Ruby, and we will have the same problem there as well. The logger gem also does not support Ruby <= 2.2.
mattbrictson
changed the title
Can't install sshkit on Ruby 2.2 or older
Can't install latest sshkit on Ruby 2.2 or older
Jan 12, 2025
I'd lean towards not supporting older Ruby. According to https://www.ruby-lang.org/en/downloads/branches/, Ruby 2.1 went out of support on 2017-03-31. That's a long time ago in computer terms. And if someone is forced to use a very old version of Ruby, they do have the option of pinning Capistrano to an older version too.
Using Ruby 2.2:
Attempt to install sshkit:
The problem is that we have added a dependency on the base64 gem in order to support Ruby 3.4+, but the base64 gem is not available on Ruby 2.2 or older.
In our gemspec, we have this line:
sshkit/sshkit.gemspec
Line 23 in d8acf40
However, this doesn't work as intended. The
RUBY_VERSION
check is evaluated at gem publishing time, not at runtime. Assuming we publish the gem using a recent version of Ruby (which we do), then the gem will always have the base64 dependency, regardless of the Ruby version being used to install sshkit.Further explanation about why it is bad to use
RUBY_VERSION
conditionals: rubocop/ruby-style-guide#763Therefore, I think there are two potential fixes:
base64
dependency entirely. This will fix installation on old versions of Ruby. However people using Ruby 3.4+ will have a bad experience: they will need to manually installbase64
or add it to their Gemfile, otherwise sshkit won't work.I'm leaning toward dropping support for old versions of Ruby, given the fact that we have not received any bug reports from people using old versions of Ruby regarding this issue.
Edit: the last version of sshkit that seems to successfully install on Ruby 2.2 is sshkit 1.22.0.
The text was updated successfully, but these errors were encountered: