Home > Back-end >  Rails vs Ruby Version Clashing
Rails vs Ruby Version Clashing

Time:11-09

I'm trying to run a Rails app made by a third party. System dependencies as given on the repo are below:

System dependencies

Ruby version- ruby 2.4.2p198

Rbenv version- rbenv 1.1.1

Rails version 5.2.3

Postgresql version- 1.1.4

I was able to install ruby 2.4, but when I try to install rails one of the gems fail to install because my ruby version is too old for it. Below is the screenshot of errors, I tried both installing rails and the specific gem separately.

Error img

I'm a total beginner on Ruby, and am currently extremely stuck. Anyone know how to surpass the error?

edit:added gemfile below. it looks like the failing gem racc isn't even used.. but rails doesnt install without it. should i just update ruby to 2.5 and take a chance?

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.4.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.3'
# Use sqlite3 as the database for Active Record
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'select2-rails', github: 'commutatus/select2-rails'
gem 'draper'
gem 'postmark'
gem 'pundit'
gem 'fast_jsonapi'
gem 'scout_apm'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

gem 'will_paginate'
gem 'bootsnap'
gem 'popper_js', '~> 1.14.5'
gem 'aws-sdk-s3', require: false
gem 'jquery-rails'
gem "chartkick"

gem 'slim-rails'
gem 'simple_form'
gem 'kaminari',  github: 'amatsuda/kaminari'
gem 'devise'
gem 'devise_invitable', '~> 1.7.0'
gem 'bootstrap-glyphicons'
gem 'rails-assets-jgrowl', source: 'https://rails-assets.org'
gem 'rails-assets-sweetalert2', '7.29.1', source: 'https://rails-assets.org'
gem 'remotipart'
gem 'local_time'
gem 'rollbar'
gem 'paper_trail'
gem 'paper_trail-association_tracking'
gem 'bootstrap-datepicker-rails', '~> 1.8', '>= 1.8.0.1'
gem 'momentjs-rails'
gem 'rails-assets-fullcalendar', source: 'https://rails-assets.org'
gem 'cocoon'
gem 'whenever', require: false
gem 'tzinfo'
gem 'zip-zip'
gem 'wicked_pdf', '1.4.0'
gem 'wkhtmltopdf-binary'
gem 'wkhtmltopdf-binary-edge'
gem 'nationality', '~> 1.0.3'
gem 'geocoder'
gem 'money-rails', '~>1.12'
gem 'city-state'

#Cross-origin Resource Sharing
gem 'rack-cors'

# For Excel rendering
gem 'rubyzip', '>= 1.2.1'
gem 'caxlsx'
gem 'axlsx_rails'
gem "roo", "~> 2.8.0"

# Draggable functionality
gem 'jquery-ui-rails'
gem 'acts_as_list'

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development, :test, :staging do
  gem 'rspec-rails', '~> 3.8'
  gem 'fabrication'
  gem 'faker'
  gem 'database_cleaner'
  gem 'better_errors'
  gem 'binding_of_caller'
end
group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  gem 'overcommit', '~> 0.47.0'
  gem 'coffeelint', '~> 1.16', '>= 1.16.1'
  gem 'rails_best_practices', '~> 1.19', '>= 1.19.4'
  gem 'rubocop', '~> 0.67.2'
  gem 'scss_lint', '~> 0.38.0', require: false
  gem "rubycritic", require: false

end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
end

#Cross-origin Resource Sharing
gem 'rack-cors'

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'acts_as_paranoid'
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'

CodePudding user response:

The developers of the racc gem removed support of Ruby 2.4 not so long time ago.

One of the solutions might be to install racc from a specific commit which was made right before the breaking update. Try to add this line to your Gemfile and run bundle install

gem 'racc', git: 'https://github.com/ruby/racc.git', ref: 'd66cd1216669ec8acd05b57a4f0de76cc471938c'

Another solution is to use the previous version of the gem:

gem 'racc','~> 1.5.2'

CodePudding user response:

Can you try to use this line, it will work with you. First update the package index:

$ sudo apt update

Then use this line:

$ sudo apt install ruby-full
  • Related