rubygems-update requires Ruby version >= 2.3.0.

Created on 20 Dec 2018  路  3Comments  路  Source: rubygems/rubygems

I'm having a problem or would like to suggest a feature.

My current problem is that I have projects using travis-ci to test them under ruby 2.2.
The command gem update --system broken after rubygems 3.0.0 being released.
https://github.com/rubygems/rubygems/blob/297c725d5051135f4a7ab6425c5a5dd8e34287d5/History.txt#L3

The error messages:

gem update --system
Updating rubygems-update
ERROR:  Error installing rubygems-update:
    rubygems-update requires Ruby version >= 2.3.0.
ERROR:  While executing gem ... (NoMethodError)
    undefined method `version' for nil:NilClass
The command "gem update --system" failed and exited with 1 during .

Your build has been stopped.

I would like to known how to update rubygems to the latest compatible version without throwing errors?

This issue is related to:

  • [ ] Network problems
  • [ ] Installing a library
  • [ ] Publishing a library
  • [X] The command line gem
  • [ ] Other

Here are my current environment details:

$ ruby --version
ruby 2.2.7p470 (2017-03-28 revision 58194) [x86_64-linux]

$ rvm --version
rvm 1.29.3 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

$ bundle --version
Bundler version 1.16.0

$ gem env version
2.6.11

I will abide by the code of conduct.

Most helpful comment

RubyGems 3.0.0 is only installable on Ruby >= 2.3

For 2.2 & 2.2.10, try

  - gem install "rubygems-update:<3.0.0" --no-document
  - update_rubygems

At present, RubyGems does not correctly handle Ruby version constraints.

EDIT: Windows type, not a bash type. For all Ruby versions, try:

gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems)
gem update bundler --conservative

It does waste a bit of time downloading 3.0.0 when used on Ruby 2.2, but it still installs 2.7.8...

All 3 comments

would like to known how to update rubygems to the latest compatible version without throwing errors?

I hit the same problem and worked around like this. https://github.com/colszowka/simplecov/commit/ba423820d1d1164fcc038e7b6163b8a96d1786be

RubyGems 3.0.0 is only installable on Ruby >= 2.3

For 2.2 & 2.2.10, try

  - gem install "rubygems-update:<3.0.0" --no-document
  - update_rubygems

At present, RubyGems does not correctly handle Ruby version constraints.

EDIT: Windows type, not a bash type. For all Ruby versions, try:

gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems)
gem update bundler --conservative

It does waste a bit of time downloading 3.0.0 when used on Ruby 2.2, but it still installs 2.7.8...

Please use solutions of @amatsuda or @MSP-Greg.

Was this page helpful?
0 / 5 - 0 ratings