Herokuproblem 推送问题:错误:无法将一些引用推送到“https://git.heroku.com/wwwwwww.git”

时间:2021-07-04 11:28:55

标签: ruby-on-rails heroku deployment heroku-cli heroku-ci

我正在尝试将我的 Rails 应用程序推送到 Heroku,但它一次又一次地向我显示此错误。有什么问题?

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'

我运行了 heroku loginheroku create,在完成一些步骤后,我运行了 git push heroku main 并出现了此错误。我也试过 git push heroku main: main,但这并没有改变任何东西。然后我创建了一个分支,然后例如 dev 然后我运行了 git push heroku dev:main 但它再次失败。

1 个答案:

答案 0 :(得分:1)

这与您如何推动 main 无关。创建一个分支并在推送时明确命名远程分支将无济于事。

仔细查看错误信息:

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 不受支持,但如果您访问 the page mentioned in the error message,您应该会看到版本 2.7。3 受支持(在撰写本文时)。

Update your Gemfile accordingly、提交和重新部署。