I have rvm installed on my PC with the default ruby gemset being 2.4.1
rvm list
ruby-2.4.0 [ x86_64 ]
=* ruby-2.4.1 [ x86_64 ]
ruby-2.6.3 [ x86_64 ]
# => - current
# =* - current && default
# * - default
I want to install rails 5 however sprockets
fails to install requiring 2.5 ruby. However rails 5 should work with any ruby above 2.2.2:
gem install rails -v 5.1.4
Fetching: activesupport-5.1.4.gem (100%)
Successfully installed activesupport-5.1.4
Fetching: actionview-5.1.4.gem (100%)
Successfully installed actionview-5.1.4
Fetching: actionpack-5.1.4.gem (100%)
Successfully installed actionpack-5.1.4
ERROR: Error installing rails:
sprockets requires Ruby version >= 2.5.0.
I don't care about the rails 5 version. The newer the better, but all versions do give me the errors
Any idea why this might happen?
The latest (4.0.0) version of sprockets really requires ruby >= 2.5.0
. Check it here
Is gem 'sprockets'
in your Gemfile
set to a specific version?
To manually change version of sprockets add the line bellow to your Gemfile
gem 'sprockets', '~> 3.7.2'
If you do not have a Gemfile yet try direct installation.
gem install sprockets -v 3.7.2
For those that are experiencing this without having it explicitly specified in the gemfile, another workaround is to install the previous version manually:
gem install sprockets -v 3.7.2
Rails 5 may only require Ruby => 2.2.2
but if you don't version gems in your Gemfile
it will always pull down the latest version of the gems. A later gem version then might need a higher version of Ruby.
This however has nothing to do with rails!
Also you might have a Problem with Ruby 2.4.1 using it with Rails 5.1.4
Which Ruby on Rails is compatible with which Ruby version?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With