【问题标题】:Herokuproblem pushing problem: error: failed to push some refs to 'https://git.heroku.com/wwwwwww.git'Herokuproblem 推送问题:错误:未能将一些参考推送到“https://git.heroku.com/wwwwwww.git”
【发布时间】:2021-09-15 12:50:00
【问题描述】:

我正在尝试将我的 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 但它再次失败。

【问题讨论】:

  • 您是否能够使用下面显示的任何答案来解决这个问题?如果是这样,请记得accept it。这会向其他用户显示您找到了解决方案。

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


【解决方案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,提交并重新部署。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-30
    • 1970-01-01
    • 2017-12-07
    • 2023-03-30
    • 1970-01-01
    • 2022-01-25
    • 2021-08-07
    相关资源
    最近更新 更多