I have tried changing the gemfile to an earlier version and then pushing again but it does not seem to work. Here is the code. Any ideas?
Not sure I have posted in the correct format, this is my first SO post.
Any help would be appreciated, my command git push heroku master generates that output.
Counting objects: 133, done.
Compressing objects: 100% (109/109), done.
Writing objects: 100% (133/133), 152.51 KiB | 3.81 MiB/s, done.
Total 133 (delta 14), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.1.4
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.6.3.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.6.3.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.6.3 on heroku-20.
remote: !
remote: ! Ruby ruby-2.6.3 is present on the following stacks:
remote: !
remote: ! - cedar-14
remote: ! - heroku-16
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: !
remote: ! ## Warning - The same version of this code has already been built: 5cf5d180a3b3f6f75291fac84f9be0b99d863efc
remote: !
remote: ! We have detected that you have triggered a build from source code with version 5cf5d180a3b3f6f75291fac84f9be0b99d863efc
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a enter code heredifferent branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to afternoon-garden-77939.
remote:
To https://git.heroku.com/afternoon-garden-77939.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/afternoon-garden-77939.git'
heroku stack
heroku stack:set heroku-18
detail view https://devcenter.heroku.com/articles/stack
haohaobaozhi has the perfect answer here.
heroku stack:set heroku-18
I was having the same issue as OP and setting the stack to Heroku-18 solved the issue. This might be a common occurrence for those following the "Learn Enough Ruby On Rails To Be Dangerous" Book.
remote: ! You are trying to install ruby-2.6.3 on heroku-20.
remote: !
remote: ! Ruby ruby-2.6.3 is present on the following stacks:
remote: !
remote: ! - cedar-14
remote: ! - heroku-16
remote: ! - heroku-18
Currently supported Ruby version for heroku-20 can be seen here:
https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
2.6.6, Rubygems: 3.0.3
2.7.2, Rubygems: 3.1.4
3.0.0, Rubygems: 3.2.3
The list will change with time (new ubuntu/heroku releases, new Ruby versions release, ...)
Update your ruby version (and make sure your project is compatible with the new ruby version).
heroku stack:set heroku-18 --app your-app-name
Related
I'm very new to software programming, so bear with me. I'm taking an online web development course that uses Ruby on Rails via AWS on Cloud9. I've gotten to a point in the course where it's time to push my program to Heroku, but it's not working. As you'll see in the code I attached below, it states "The Ruby version you are trying to install does not exist: ruby-2.3.0." It's an old version of Ruby, so that's understandable. It's an old course, after all.
Naturally, I tried to install a more updated version of Ruby (Ruby 2.7.6) in my virtual workstation, and I received confirmation from my command line that it had installed successfully. Or so I thought. After attempting to deploy the code again to Heroku, I received the same notification - that Ruby 2.3.0 doesn't exist. But I thought I had updated my Ruby version? Meanwhile, I cannot continue the course until this is resolved. Any help would be greatly appreciated. Thank you!
ec2-user:~/environment/saasapp (master) $ git push heroku master
Enumerating objects: 15518, done.
Counting objects: 100% (15518/15518), done.
Compressing objects: 100% (8189/8189), done.
Writing objects: 100% (15518/15518), 38.29 MiB | 42.71 MiB/s, done.
Total 15518 (delta 5945), reused 15518 (delta 5945), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-18 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Ruby app detected
remote: -----> Installing bundler 1.17.3
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://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-18/ruby-2.3.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://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-18/ruby-2.3.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: ruby-2.3.0
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: !
remote: ! ## Warning - The same version of this code has already been built: 0c41dc02b467640a074f0ffcb8c93cf034e44fad
remote: !
remote: ! We have detected that you have triggered a build from source code with version 0c41dc02b467640a074f0ffcb8c93cf034e44fad
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to secret-shelf-76327.
remote:
To https://git.heroku.com/secret-shelf-76327.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/secret-shelf-76327.git'
The rails version you are currently working in and the rails version present in your bin/rails file is different. you just need to regenerate the binstubs file with your local ruby version.
Run this command to regenerate your bundler file.
bundle binstubs bundler --force
for more info refer the doc here.
https://bundler.io/man/bundle-binstubs.1.html
You can define the ruby version in the Gemfile itself.
source 'https://rubygems.org'
ruby "2.6.5"
Add these lines at the top of your Gemfile and do a bundle install again.
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.
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.
I try to push my git repo to Heroku, but I get error:
remote: -----> Installing node-v12.16.2-linux-x64
remote: -----> Detecting rake tasks
remote:
remote: !
remote: ! Could not detect rake tasks
remote: ! ensure you can run `$ bundle exec rake -P` against your app
remote: ! and using the production group of your Gemfile.
remote: ! /tmp/build_641166cf/bin/rake:8:in `require': cannot load such file -- rake (LoadError)
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 93a5bb6ab6e77c479f857031010316f9f372e20f
remote: !
remote: ! We have detected that you have triggered a build from source code with version 93a5bb6ab6e77c479f857031010316f9f372e20f
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to whispering-fortress-58873.
remote:
To https://git.heroku.com/whispering-fortress-58873.git
! [remote rejected] master -> master (pre-receive hook declined)
error: не удалось отправить некоторые ссылки в «https://git.heroku.com/whispering-fortress-58873.git»
How to fix it? I've been trying to fix this for two days now.
Ruby version: 2.7.2
Rails version: 5.2.4.4
Gem version: 3.1.4
Bundler version: 2.2.7
Checking error logs it seems that you need to push your branch to main
Try the following (or replace master with your current branch)
git push heroku master:main
I just upgraded an old app from Heroky running ruby on rails. I upgraded both ruby 1.9.3 to 2.5.1 and rails 3.2 to 5.2.0.
Then I created a new app on Heroku and try to deploy, but I keep getting an error message saying Heroku cannot install 1.9.3.
Here is the error log:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
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-16/ruby-1.9.3-p551.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-16/ruby-1.9.3-p551.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3.
remote: !
remote: ! An error occurred while installing ruby-1.9.3-p551
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: !
remote: ! Debug InformationCommand: '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-16/ruby-1.9.3-p551.tgz -s -o - | tar zxf - ' failed unexpectedly:
remote: !
remote: ! gzip: stdin: unexpected end of file
remote: ! tar: Child returned status 1
remote: ! tar: Error is not recoverable: exiting now
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to nbmen-staging.
remote:
To https://git.heroku.com/nbmen-staging.git
! [remote rejected] master -> master (pre-receive hook declined)
In my Gemfile, I have:
source 'https://rubygems.org'
ruby '2.5.1'
gem 'rails', '5.2.0'
In Gemfile.lock, I have:
RUBY VERSION
ruby 2.5.1p57
BUNDLED WITH
1.16.1
There is also a .rbenv-version file and I changed the content from 1.9.3 to 2.5.1.
And I still gets the "An error occurred while installing ruby-1.9.3-p551" message. What am I missing?
seems like you may have an old/unrealeased heroku buildpack, as the bundler version is not being output in your build (and consequently you may be using an old bulder version).
What I would have expected to see is:
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.5.1
-----> Installing dependencies using bundler 1.15.2
...
To check your buildpack:
$ heroku buildpacks
=> heroku/ruby
If it doesn't output heroku/ruby, then you are running an old/unreleased buildpack
To install the latest buildpack:
heroku buildpacks:set heroku/ruby
For more information: https://devcenter.heroku.com/articles/bundler-version
The Ruby version file is now called .ruby-version.
The file that you have is called .rbenv-version. It's an old name and it's not supported anymore.
You can try renaming it.
I'm trying to create a app on Heroku, but when I try to push to Heroku, I get this error:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: !
remote: ! An error occurred while installing Ruby ruby-2.1.0
remote: ! For supported Ruby versions see https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote: ! Note: Only the most recent version of Ruby 2.1 is supported on Cedar-14
remote: ! Command: 'set -o pipefail; curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.1.0.tgz -s -o - | tar zxf - ' failed unexpectedly:
remote: !
remote: ! gzip: stdin: unexpected end of file
remote: ! tar: Child returned status 1
remote: ! tar: Error is not recoverable: exiting now
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
How do I solve this?
From http://news.railstutorial.org/heroku-update/
"Heroku’s recently announced Cedar-14 stack is incompatible with all but the most recent version of each Ruby sequence, meaning (for example) that it works with Ruby 2.1.4 but not with 2.1.3. Unfortunately, this makes it incompatible with the local Ruby versions on many systems"
So it looks like you need to update your Ruby to the latest version.
Ruby 2.1.0 is not supported by Heroku. Check out https://devcenter.heroku.com/articles/ruby-support#ruby-versions for a list of supported versions.