Using Xcode 9 and Swift 4 as well as vapor heroku push
/ vapor heroku init
, I receive:
-----> Swift app detected
Cloning into 'swiftenv'...
Swift 3 Heroku Installer
š¢ Version: 3.1.1
š„ Operating System: ubuntu1404
š¦ Installing Swiftenv
Cloning into '/app/.swiftenv'...
š¦ Installing Swift
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
/tmp/swiftenv-3.1.1- /tmp/build_d
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
/tmp/build_d
3.1.1 has been installed.
ā
Done
-----> Installing clang-3.7.0
precompile
-----> Building Package ... this will take a while
swift-build: error: Package requires minimum Swift tools version 4.0.0. Current Swift tools version is 3.1.0
! Push rejected, failed to compile Swift app.
! Push failed
In the Package.swift
file it says:
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "name",
products: [
.library(name: "App", targets: ["App"]),
.executable(name: "Run", targets: ["Run"])
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", .upToNextMajor(from: "2.1.0")),
.package(url: "https://github.com/vapor/fluent-provider.git", .upToNextMajor(from: "1.2.0")),
],
targets: [
.target(name: "App", dependencies: ["Vapor", "FluentProvider"],
exclude: [
"Config",
"Public",
"Resources",
]),
.target(name: "Run", dependencies: ["App"]),
.testTarget(name: "AppTests", dependencies: ["App", "Testing"])
]
)
Other than that it is literally the initial api template project. What am I missing? Help is very appreciated.
The project template was recently updated to require Swift 4, but the Heroku buildpack still installs Swift 3.1.1 by default. Until the template is updated to resolve this situation, do this:
.swift-version
in your project root with 4.0
inside.The buildpack will now install Swift 4 and your project will compile.
I have updated the buildpack, therefore the steps above are no longer necessary.
New applications and pushes without a pinned version will use Swift 4.0.2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With