Heroku 推送失败

Posted

技术标签:

【中文标题】Heroku 推送失败【英文标题】:Heroku Failed Push 【发布时间】:2021-12-30 15:35:52 【问题描述】:

我正在尝试使用以下命令向 heroku 推送一些东西:“git push heroku HEAD:main”

我在 CMD 中得到的错误是:

    "! [remote rejected] HEAD -> main (pre-receive hook declined)
      error: failed to push some refs to 'https://git.heroku.com/discordbotonline247.git'"
    
     And if i check Heroku logs i find this:
    -----> Building on the Heroku-20 stack
    
    -----> Using buildpack: heroku/python
    
    -----> Python app detected
    
    -----> No Python version was specified. Using the buildpack default: python-3.9.9
    
           To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
    
    -----> Installing python-3.9.9
    
    -----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0
    
    -----> Installing SQLite3
    
    -----> Installing requirements with pip
    
           Collecting git+https://github.com/Rapptz/discord.py@rewrite (from -r /tmp/build_3181f09c/requirements.txt (line 1))
    
             Cloning https://github.com/Rapptz/discord.py (to revision rewrite) to /tmp/pip-req-build-wpl2aq36
    
             Running command git clone --filter=blob:none -q https://github.com/Rapptz/discord.py /tmp/pip-req-build-wpl2aq36
    
             WARNING: Did not find branch or tag 'rewrite', assuming revision or ref.
    
             Running command git checkout -q rewrite
    
             error: pathspec 'rewrite' did not match any file(s) known to git
    
           WARNING: Discarding git+https://github.com/Rapptz/discord.py@rewrite. Command errored out with exit status 1: git checkout -q rewrite Check the logs for full command output.
    
           ERROR: Command errored out with exit status 1: git checkout -q rewrite Check the logs for full command output.
    
     !     Push rejected, failed to compile Python app.
    
     !     Push failed

在我的 Procfile 中我有:

"worker: python Discord_Bot.py

在我的 requirements.txt 我有:

"git+https://github.com/Rapptz/discord.py@rewrite
 PyNaCl==1.3.0
 pandas
 dnspython==1.16.0
 async-timeout==3.0.1"

请帮忙!

【问题讨论】:

【参考方案1】:

您需要删除 require.txt 文件中的引号以及 Github 链接中的 @rewrite。但是,不要删除@rewrite,只需指定不和谐版本。将您的 requirements.txt 文件替换为以下内容:

discord.py==1.6.0
PyNaCl==1.3.0
pandas
dnspython==1.16.0
async-timeout==3.0.1

【讨论】:

Tysm 或许你可以帮忙看看我发表的评论,在这里评论它太大了 @SdejSdeyt 首先,请通过单击否决按钮下方的复选标记将我的答案标记为正确,以便查看此问题的其他人知道此答案有效。其次,请将您的新问题作为单独的问题发布,而不是在此线程中。 好的,我会这样做的 快速评论!

以上是关于Heroku 推送失败的主要内容,如果未能解决你的问题,请参考以下文章

Heroku推送失败并出现关于sqlite3的错误[重复]

Heroku 构建失败 - 推送被拒绝,无法编译 node.js 应用程序,无法缩小包,许多错误

在 Heroku 部署中构建失败

git push heroku master 失败 / RoR 应用程序

由于“错误:‘URLSession’类型的值没有成员‘数据’”,将 Vapor 应用程序部署到 Heroku 失败

git push heroku master 因“HTTP 400 curl 22 The requested URL returned error”而失败