報錯信息
?? MyService git:(master) ? git push heroku master
Counting objects: 43, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (33/33), done.
Writing objects: 100% (43/43), 11.58 KiB | 2.90 MiB/s, done.
Total 43 (delta 2), 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.1.1
remote: ??? Operating System: ubuntu1404
remote: ?? Installing Swiftenv
remote: Cloning into '/app/.swiftenv'...
remote: ?? Installing Swift
remote: Downloading https://swift.org/builds/swift-3.1.1-release/ubuntu1604/swift-3.1.1-RELEASE/swift-3.1.1-RELEASE-ubuntu16.04.tar.gz
remote: /tmp/swiftenv-3.1.1- /tmp/build_cb17ea379ff9bebcfbc59b704bf4d24c
remote:? % Total? ? % Received % Xferd? Average Speed? Time? ? Time? ? Time? Current
remote:? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Dload? Upload? Total? Spent? ? Left? Speed
remote: 100? 117M? 100? 117M? ? 0? ? 0? 6374k? ? ? 0? 0:00:18? 0:00:18 --:--:-- 5794k
remote: /tmp/build_cb17ea379ff9bebcfbc59b704bf4d24c
remote: 3.1.1 has been installed.
remote: ?? Done
remote: -----> Installing clang-3.7.0
remote: precompile
remote: -----> Building Package ... this will take a while
remote: swift-build: error: Package requires minimum Swift tools version 4.0.0. Current Swift tools version is 3.1.0
remote:? !? ? Push rejected, failed to compile Swift app.
remote:
remote:? !? ? Push failed
remote: Verifying deploy...
解決方法在:
在你的vapor工程的根目錄下新建.swift-version文件
打開控制臺 輸入touch .swift-version 新建文件
用編輯器打開文件 open -e .swift-version 輸入4.0保存
然后就OK了 因為是屬于隱藏文件夾 所以需要手動添加
git add .swift-version
然后編輯
git commit -am "make it better
重新上傳奸柬。成功
git push heroku master