You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

修改Vapor/Swift代码后推送至Heroku失败,求解决方案

解决Heroku推送Vapor项目时的curl解压错误

看起来你遇到的问题根源在于你使用的第一个buildpack(vzsg/heroku-buildpack-curl-http2)已经过时了——它尝试下载的curl 7.52.1资源可能已经失效,导致下载的内容不是有效的tar.gz归档文件,所以才会出现tar: This does not look like a tar archive和gzip: stdin: not in gzip format的错误。

这里有几个可行的解决思路:

1. 移除过时的curl buildpack

Vapor社区官方的Heroku buildpack现在已经内置了足够的curl支持,不需要额外安装旧版本的curl。执行以下命令移除失效的buildpack:

heroku buildpacks:remove https://github.com/vzsg/heroku-buildpack-curl-http2.git

确认buildpack列表只保留Vapor的官方buildpack:

heroku buildpacks

之后重新提交并推送代码:

git commit --allow-empty -m "Remove outdated curl buildpack"
git push heroku master

2. 若需自定义curl版本,改用Apt Buildpack

如果你确实需要特定版本的curl,可以使用Heroku的官方apt buildpack来安装,步骤如下:

  • 添加apt buildpack到列表顶部:
    heroku buildpacks:add --index 1 heroku-community/apt
    
  • 在项目根目录创建Aptfile文件,内容为你需要的curl版本(比如最新稳定版直接写curl,或者指定版本如curl=7.88.1-10+deb12u5)
  • 提交文件并重新推送:
    git add Aptfile
    git commit -m "Add Aptfile for curl installation"
    git push heroku master
    

附你遇到的错误信息:
remote: -----> Downloading curl 7.52.1
remote: tar: This does not look like a tar archive
remote:
remote: gzip: stdin: not in gzip format
remote: tar: Child returned status 1
remote: tar: Error is not recoverable: exiting now
remote: ! Push rejected, failed to compile curl app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to frozen-sea-46940.
remote: To https://git.heroku.com/frozen-sea-46940.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/frozen-sea-46940.git'
Completed with errors, see above

内容的提问来源于stack exchange,提问作者János

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:43:24