我已经使用 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'
我的存储库的主分支是干净的并且是最新的,没有来自其他地方的未决提交(只有代码在处理)。
最佳答案
哈! Vapor Slack 上的人已经整理好了。 pbodsk,你是对的,这是一个 Swift 3.1 问题。
您需要在您的 Vapor 项目的根目录中创建一个 .swift-version
文件。该文件的内容很简单:
3.1
当它被推送到 Heroku 时,它将使用正确版本的 Swift 进行编译。
请注意,如果您遇到此问题,您还需要执行此操作:
关于swift - Vapor:git push heroku master 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43135311/