I try to deploy hello world app for testing purpose. I check my swift tools version and it's 4.0
acme-iMac:HelloWorldWeb johndoe$ swift --version
Apple Swift version 4.0 (swift-4.0-RELEASE)
Target: x86_64-apple-macosx10.9
I also use swiftenv and it's point to version 4.0 as well.
acme-iMac:HelloWorldWeb johndoe$ swiftenv version
4.0 (set by /Users/johndoe/Vapor/HelloWorldWeb/.swift-version)
The Package.swift file also seems fine
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "HelloWorldWeb",
products: [
.library(name: "App", targets: ["App"]),
.executable(name: "Run", targets: ["Run"])
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", .upToNextMajor(from: "2.2.0")),
.package(url: "https://github.com/vapor/leaf-provider.git", .upToNextMajor(from: "1.1.0")),
],
targets: [
.target(name: "App", dependencies: ["Vapor", "LeafProvider"],
exclude: [
"Config",
"Database",
"Public",
"Resources"
]),
.target(name: "Run", dependencies: ["App"]),
.testTarget(name: "AppTests", dependencies: ["App", "Testing"])
]
)
But every time I try to vapor cloud deploy, it always failed.
Creating deployment [Done]
Connecting to build logs ...
Waiting in Queue [Done]
Checkout branch 'master' [Done]
Verifying base folder [Done]
Selected swift version: 3.1.0 [Done]
Selected swift version: 3.1.0 [Done]
Building vapor [Failed]
swift-build: error: Package requires minimum Swift tools version 4.0.0. Current Swift tools version is 3.1.0
Error: deploy failed.
The app run successfully on local machine.
Vapor Cloud needs to be told to use Swift 4; it defaults to 3.1.
Add a file named cloud.yml
to the root directory of your project, containing:
type: "vapor"
swift_version: "4.0.0"
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