-
Notifications
You must be signed in to change notification settings - Fork 22k
Description
Steps to reproduce
From a clean machine with no versions of globalid
already installed (or gem uninstall globalid
to remove it)
Install Ruby 2.5.*
Install Rails 6.1.4 (pick any version. even versions from 7 yrs ago has a dependency specification globalid >= 0.{something}
)
$ ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin19]
$ gem uninstall -aIx
...output omitted...
$ gem install rails
Fetching activesupport-6.1.4.gem
Fetching tzinfo-2.0.4.gem
Fetching zeitwerk-2.4.2.gem
Fetching i18n-1.8.10.gem
Fetching concurrent-ruby-1.1.9.gem
Fetching minitest-5.14.4.gem
Fetching rack-2.2.3.gem
Fetching rack-test-1.1.0.gem
Fetching crass-1.0.6.gem
Fetching racc-1.5.2.gem
Fetching nokogiri-1.11.7-x86_64-darwin.gem
Fetching loofah-2.11.0.gem
Fetching rails-html-sanitizer-1.3.0.gem
Fetching rails-dom-testing-2.0.3.gem
Fetching builder-3.2.4.gem
Fetching erubi-1.10.0.gem
Fetching actionview-6.1.4.gem
Fetching actionpack-6.1.4.gem
Fetching activemodel-6.1.4.gem
Fetching activerecord-6.1.4.gem
Fetching activejob-6.1.4.gem
Fetching mini_mime-1.1.0.gem
Fetching actionmailer-6.1.4.gem
Fetching globalid-0.5.1.gem
Fetching actioncable-6.1.4.gem
Fetching marcel-1.0.1.gem
Fetching mail-2.7.1.gem
Fetching activestorage-6.1.4.gem
Fetching nio4r-2.5.7.gem
Fetching websocket-extensions-0.1.5.gem
Fetching websocket-driver-0.7.5.gem
Fetching actionmailbox-6.1.4.gem
Fetching actiontext-6.1.4.gem
Fetching railties-6.1.4.gem
Fetching sprockets-4.0.2.gem
Fetching sprockets-rails-3.2.2.gem
Fetching rails-6.1.4.gem
Fetching rake-13.0.6.gem
Fetching thor-1.1.0.gem
Fetching method_source-1.0.0.gem
Successfully installed concurrent-ruby-1.1.9
Successfully installed i18n-1.8.10
Successfully installed tzinfo-2.0.4
Successfully installed zeitwerk-2.4.2
Successfully installed minitest-5.14.4
Successfully installed activesupport-6.1.4
Successfully installed rack-2.2.3
Successfully installed rack-test-1.1.0
Successfully installed crass-1.0.6
Building native extensions. This could take a while...
Successfully installed racc-1.5.2
Successfully installed nokogiri-1.11.7-x86_64-darwin
Successfully installed loofah-2.11.0
Successfully installed rails-html-sanitizer-1.3.0
Successfully installed rails-dom-testing-2.0.3
Successfully installed builder-3.2.4
Successfully installed erubi-1.10.0
Successfully installed actionview-6.1.4
Successfully installed actionpack-6.1.4
Successfully installed activemodel-6.1.4
Successfully installed activerecord-6.1.4
ERROR: Error installing rails:
The last version of globalid (>= 0.3.6) to support your Ruby & RubyGems was 0.4.2. Try installing it with `gem install globalid -v 0.4.2` and then running the current command again
globalid requires Ruby version >= 2.6.0. The current ruby version is 2.5.3.105.
Expected behavior
According to the Rails gemspec, Ruby 2.5.0 should be supported:
https://github.com/rails/rails/blob/v6.1.4/rails.gemspec#L12
Rails should install successfully, as it always had (until last week)
Actual behavior
ERROR: Error installing rails:
The last version of globalid (>= 0.3.6) to support your Ruby & RubyGems was 0.4.2. Try installing it with `gem install globalid -v 0.4.2` and then running the current command again
globalid requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.
This is due to transitive dependency globalid
dropping ruby 2.5 support, but rails still claims to support it.
Dependency tree:
rails 6.1.4: https://github.com/rails/rails/blob/v6.1.4/rails.gemspec#L37
s.required_ruby_version = ">= 2.5.0"
s.add_dependency "activejob", version
activejob: https://github.com/rails/rails/blob/v6.1.4/activejob/activejob.gemspec#L35
s.required_ruby_version = ">= 2.5.0"
s.add_dependency "globalid", ">= 0.3.6"
globalid: https://github.com/rails/globalid/blob/main/globalid.gemspec#L8
s.required_ruby_version = '>= 2.6.0'
This drop of ruby support was made in the update from globalid 0.4 to 0.5.
I believe activejob
should have it's dependency set to>= 0.3.6
<5.0.0
However all past versions of Rails (going back 7 yrs at least) had the dependency globalid >= ...
so globalid has to be futureproof forever and never drop any version of ruby. (the real issue is that >
should probably never be used as a transitive dependency version range)
System configuration
Rails version: 6.1.4 (any version will cause the same error though)
Ruby version: 2.5.0 (anything 2.5.* will cause the issue)
Workarounds
For those that run into this issue:
Workaround 1:
One workaround is given in the error output. If you manually install globalid 0.4.2
first, then gem install
will use that already installed version instead of trying to pick up the latest 0.5.1
$ gem install globalid -v 0.4.2
$ gem install rails
will install successfully
Workaround 2:
As mentioned in the comments, it seems that newer versions of rubygems will automatically resolve this by falling back to the latst version that supports your version of ruby. However rubygems that ships with 2.5 did not have this feature. You can upgrade rubygems after installing ruby to resolve this issue.
$ gem update --system
$ gem install rails