Vapor:git push heroku master 失败

4

我最近几周一直在使用Vapor和Heroku工作,一切进行得很顺利。Vapor真的很棒!;] 我一直都可以成功地使用git push heroku master来更新Heroku上的应用程序,但昨晚开始出现了以下错误:

$ git push heroku master
Counting objects: 26, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (24/24), done.
Writing objects: 100% (26/26), 7.37 KiB | 0 bytes/s, done.
Total 26 (delta 15), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Swift app detected
remote: Cloning into 'swiftenv'...
remote: Swift 3 Heroku Installer
remote:   Version: 3.0.2
remote:   Operating System: ubuntu1404
remote:  Installing Swiftenv
remote: Cloning into '/app/.swiftenv'...
remote:  Installing Swift
remote: Downloading https://swift.org/builds/swift-3.0.2-release/ubuntu1404/swift-3.0.2-RELEASE/swift-3.0.2-RELEASE-ubuntu14.04.tar.gz
remote: /tmp/swiftenv-3.0.2- /tmp/build_577666a1ce2003bd1d820e031bc0f306
remote:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
remote:                                  Dload  Upload   Total   Spent    Left  Speed
remote: 100  113M  100  113M    0     0  8057k      0  0:00:14  0:00:14 --:--:-- 8613k
remote: /tmp/build_577666a1ce2003bd1d820e031bc0f306
remote: 3.0.2 has been installed.
remote:   Done
remote: precompile
remote: -----> Installing toolbox
remote: Downloading...
remote: Compiling...
remote: <unknown>:0: error: build had 1 command failures
remote: swift-build: error: exit(1): /app/.swiftenv/versions/3.0.2/usr/bin/swift-build-tool -f /tmp/build_577666a1ce2003bd1d820e031bc0f306/vapor-toolbox/.build/debug.yaml
remote:  !     Push rejected, failed to compile Swift app.
remote: 
remote:  !     Push failed
remote: Verifying deploy....
remote: 
remote: !   Push rejected to zzzzzzzz.
remote: 
To https://git.heroku.com/zzzzzzzz.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/zzzzzzzz.git'

我的代码库主分支干净且最新,没有来自其他地方的未提交的更改(只是在对代码进行工作)。

1
我没有什么智能的东西可以提供(但这不会阻止我:))。你是在Mac上运行吗?这可能是因为您已将本地环境更新为Swift 3.1或其他一些更新已在您的侧面或Heroku上进行。除此之外,似乎你可能不是唯一的:https://github.com/vapor/vapor/issues/766(请参阅最后几条评论)。抱歉,我不能提供实际的解决方案。 - pbodsk
嗨。感谢回复。是的,我正在使用Swift 3.1的Mac上。虽然远程构建使用的是应该是3.0.2(我相信),但我看不出这会有什么区别。 - TJ Shae
1个回答

2
哈!Vapor Slack 上的小伙伴们解决了问题。pbodsk,你说得对,这是一个 Swift 3.1 的问题。
你需要在 Vapor 项目的根目录中创建一个名为 .swift-version 的文件。文件的内容很简单:
3.1

当这个推送到Heroku上时,它将使用正确版本的Swift进行编译。
请注意,如果您遇到此问题,您也需要执行以下操作:
请参考链接:升级Swift后vapor工具箱失效

很高兴你找到了它 :) - pbodsk

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接