0

Ubuntu 22.04

I was able to install rails 1.9.2 rbenv but I can't match a rails version to it.

On the old server

rails -v returns:


The program 'rails' can be found in the following packages:

  • ruby-railties-3.2
  • ruby-railties-4.0

When I go to install Rails gem install rails

I get...

ERROR: Error installing rails: concurrent-ruby requires Ruby version >= 2.2.

BostonMacOSX
  • 1,369
  • 2
  • 17
  • 38

1 Answers1

0

I do not know why you need to run such an old version of Ruby, but I guess there are reasons.

gem install rails will just try to install the latest version of Ruby on Rails that obviously is not compatible with such ancient version of Ruby as 1.9.2.

There are pages that list the compatibility between certain Ruby and Ruby on Rails versions, for example, this or this. When looking at those tables, I guess the best choice seems to be Ruby on Rails 3.2.x. To install the latest 3.2.x version of Rails use this command:

gem install rails -v 3.2.22.5

Running such ancient Ruby and Ruby on Rails will lead to endless problems. Foremost, there are likely unfixed security vulnerabilities in those old versions. But finding good documentation, compatible gems and support in general will be hard too.

I guess from your question that you inherited an old project without much documentation and – most importantly – without a Gemfile. Therefore, I suggest adding bundler and a proper Gemfile. You will need to figure out all your app's dependencies to install the application anyway, better document those dependencies with bundler right from the start. This examples might help.

spickermann
  • 100,941
  • 9
  • 101
  • 131
  • gem install rails -v 3.2.22.5 ERROR: Error installing rails: concurrent-ruby requires Ruby version >= 2.2. – BostonMacOSX Oct 18 '22 at 11:04
  • Yes, that is expected for every single direct or indirect dependency of your application. You will always need to find a version that still works with your ancient Ruby version and then you need to configure those versions in your `Gemfile`. In this case [`'concurrent-ruby', '0.4.1'`](https://rubygems.org/gems/concurrent-ruby/versions/0.4.1) might work for you. Bundler and Gemfile were created for a reason. Without them you will need to find a matching set of all your apps dependencies manually. Try, find a working version, add it to the Gemfile and repeat until you are done. – spickermann Oct 18 '22 at 11:22
  • Ok maybe I'm misunderstanding....I don't have an application yet.. I thought I had to install RAILS before grabbing the code for the application...when I'm in Flask/Python I have to install Flask/Python/Gunicorn before installing the application.. – BostonMacOSX Oct 18 '22 at 12:02
  • If you do not have an application yet, then do yourself a favor and use an up-to-date version of Ruby and Ruby on Rails. With at the moment means Ruby 3.1.2 and Ruby on Rails 7.0.4. With up-to-date versions, you will not face these kinds of issues at all. – spickermann Oct 18 '22 at 13:43