0

I am trying to push my Rails app to Heroku but it is showing me this error again and again. What is the problem?

Enumerating objects: 140, done.
Counting objects: 100% (140/140), done.
Delta compression using up to 2 threads
Compressing objects: 100% (122/122), done.
Writing objects: 100% (140/140), 145.92 KiB | 1.50 MiB/s, done.
Total 140 (delta 10), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote:  !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote:             Detected buildpacks: Ruby,Node.js
remote:             See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.2.21
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote:        Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.7.0.tgz -s -o - | tar zxf - ' failed on attempt 1 of 3.
remote:        Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.7.0.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3.
remote: 
remote:  !
remote:  !     The Ruby version you are trying to install does not exist on this stack.
remote:  !     
remote:  !     You are trying to install ruby-2.7.0 on heroku-20.
remote:  !     
remote:  !     Ruby ruby-2.7.0 is present on the following stacks:
remote:  !     
remote:  !     - heroku-18
remote:  !     
remote:  !     Heroku recommends you use the latest supported Ruby version listed here:
remote:  !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:  !     
remote:  !     For more information on syntax for declaring a Ruby version see:
remote:  !     https://devcenter.heroku.com/articles/ruby-versions
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to first-rails-application11.
remote: 
To https://git.heroku.com/first-rails-application11.git
 ! [remote rejected] dev -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/first-rails-application11.git'

I ran heroku login and heroku create, and after completing some steps I ran git push heroku main and got this error. I also tried git push heroku main: main, but that didn't change anything. Then I created a branch and then for example, dev then I ran git push heroku dev:main but its again failing.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
bombom
  • 107
  • 2
  • 12

1 Answers1

1

This has nothing to do with how you are pushing to main. Creating a branch and explicitly naming the remote branch when you push won't help.

Take a closer look at the error message:

remote:  !     The Ruby version you are trying to install does not exist on this stack.
remote:  !     
remote:  !     You are trying to install ruby-2.7.0 on heroku-20.
remote:  !     
remote:  !     Ruby ruby-2.7.0 is present on the following stacks:
remote:  !     
remote:  !     - heroku-18
remote:  !     
remote:  !     Heroku recommends you use the latest supported Ruby version listed here:
remote:  !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:  !     
remote:  !     For more information on syntax for declaring a Ruby version see:
remote:  !     https://devcenter.heroku.com/articles/ruby-versions
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.

Ruby 2.7.0 is not supported, but if you visit the page mentioned in the error message you should see that version 2.7.3 is supported (at the time of writing).

Update your Gemfile accordingly, commit, and redeploy.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257