Heroku-18:Git 推送失败。在推送时显示 Ruby 的不同版本

Heroku-18: Git push fails. Showing different versions of Ruby on push

如果这是一个愚蠢的问题,我深表歉意。我对Ruby一无所知。还尝试了 SO 的几种解决方案。设法升级 Ruby,解决依赖关系。现在只是卡住了,无法前进。任何帮助表示赞赏。 谢谢。

当我推送时,我得到 ruby v2.2.2,但我刚刚升级到 heroku-18 支持的 2.5.7。 以下是 CLI 记录:

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-18/ruby-2.2.2.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-18/ruby-2.2.2.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3.
remote: 
remote:  !
remote:  !     An error occurred while installing ruby-2.2.2
remote:  !     
remote:  !     This version of Ruby is not available on Heroku-18. The minimum supported version
remote:  !     of Ruby on the Heroku-18 stack can found at:
remote:  !     
remote:  !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to appname-heroku18.
remote: 
To https://git.heroku.com/appname-heroku18.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/appname-heroku18.git'
Mac-Air:appname developer$ ruby -v
ruby 2.5.7p206 (2019-10-01 revision 67816) [x86_64-darwin18]
Mac-Air:appname developer$ heroku run ruby -v
 ›   Error: Multiple apps in git remotes
 ›      Usage: --remote heroku-18
 ›         or: --app appname-heroku18
 ›      Your local git repository has more than 1 app referenced in git 
 ›   remotes.
 ›      Because of this, we can't determine which app you want to run this 
 ›   command against.
 ›      Specify the app you want with --app or --remote.
 ›      Heroku remotes in repo:
 ›      appname (heroku)
 ›   appname-heroku18 (heroku-18)
 ›
 ›      https://devcenter.heroku.com/articles/multiple-environments
Mac-Air:appname developer$ heroku run ruby -v --remote
 ›   Error: Flag --remote expects a value
Mac-Air:appname developer$ heroku run ruby -v --remote heroku
Running ruby -v on ⬢ appname... up, run.1515 (Free)
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
Mac-Air:appname developer$ heroku run ruby -v --remote heroku-18
Running ruby -v on ⬢ appname-heroku18... up, run.1012 (Free)
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
Mac-Air:appname developer$ heroku run ruby -v --app appname-heroku18
Running ruby -v on ⬢ appanme-heroku18... up, run.6356 (Free)
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

您的遥控器中有两个应用程序当前被您的git引用。
只需在推送命令中指定应用名称即可。

git push ... --app appname-heroku18

看来你锁定了Ruby版本。这就是它一直尝试安装 Ruby 2.2.2 的原因。默认情况下,它应该只选择一个稳定的 Ruby 版本。

在您的 Gemfile 中查找 ruby 条目。那里应该说 2.2.2。删除它或将版本锁定为 2.5.7.

-> git push heroku master #I 运行 在我的应用程序中,我收到了该应用程序的错误消息。 我检查了“./git/”下的“配置”文件,它显示了 2 个应用程序:

[remote "origin"]
    url = https://git.heroku.com/yinow.git
    fetch = +refs/heads/*:refs/remotes/origin/*
# [remote "heroku"]
#   url = https://git.heroku.com/yinow.git
#   fetch = +refs/heads/*:refs/remotes/heroku/***

我像上面那样注释掉了“heroku”部分,然后运行再次像这样推送命令:

-> git push origin master

问题解决了!