skip to Main Content

In heroku I got this error The Ruby version you are trying to install does not exist: ruby-2.6.1

but locally when I put ruby -v I got this

ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin20]

when I do gem update bundler I got this error

Updating installed gems
Updating bundler
ERROR:  Error installing bundler:
    bundler-2.5.6 requires Ruby version >= 3.0.0. The current ruby version is 2.6.1.
Nothing to update
Gems already up-to-date: bundler

in gemfile

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

ruby "2.6.1"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.3', '>= 6.1.3.2'
# Use sqlite3 as the database for Active Record
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
group :production do
  gem 'pg'
end
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 4.1.0'
  # Display performance information such as SQL time and flame graphs for each request in your browser.
  # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
  gem 'rack-mini-profiler', '~> 2.0'
  gem 'listen', '~> 3.3'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
group :production do
  gem 'rails_12factor'
end
gem 'nokogiri', '~> 1.10', '>= 1.10.3'
gem 'bootsnap'

gem 'mail_form'
gem "recaptcha", require: "recaptcha/rails"

rbenv versions

      system
      2.4.0
    * 2.6.1 (set by /Users/nour/vancouver-786-limo-services/.ruby-version)
    3.1.0

% which -a ruby

/Users/nour/.rbenv/shims/ruby
/Users/nour/.rbenv/shims/ruby
/usr/local/opt/ruby/bin/ruby
/usr/bin/ruby

2

Answers


  1. MacOS ships with an extremely outdated version of Ruby, which is on the default PATH and is found in /usr/bin. To use a newer version of the ruby/gem commands you’ll need to install them. You can do so from source, use homebrew, or use a version manager such as rvm, rbenv, or mise (all of which can be installed directly or using homebrew). Depending on which choice you made, you may also have to update your zsh/bash config files to update PATH so your local installation is found before the system one. If you have multiple installations you can check the order of occurrence by typing which -a ruby.

    Login or Signup to reply.
  2. Heroku does support legacy and outdated Ruby versions. See the list of Ruby versions that are supported on Heroku: https://devcenter.heroku.com/articles/ruby-support#ruby-versions

    You will need to upgrade to at least Ruby 3.0 to run your application on Heroku. I suggest upgrading to the latest 3.3 version.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search