我尝试部署hello world app进行测试。我检查了我的swift工具版本及其4.0
acme-iMac:HelloWorldWeb johndoe$ swift --version
Apple Swift version 4.0 (swift-4.0-RELEASE)
Target: x86_64-apple-macosx10.9
我也使用swiftenv,它也指向4.0版。
acme-iMac:HelloWorldWeb johndoe$ swiftenv version
4.0 (set by /Users/johndoe/Vapor/HelloWorldWeb/.swift-version)
Package.swift文件似乎也很好
// 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"])
]
)
但是每当我尝试蒸汽云部署时,它总是失败。
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.
该应用在本地计算机上成功运行。
答案 0 :(得分:8)
需要告诉Vapor Cloud使用Swift 4;它默认为3.1。
将名为cloud.yml
的文件添加到项目的根目录,其中包含:
type: "vapor"
swift_version: "4.0.0"
答案 1 :(得分:0)
Vapor 1服务器 - 我发现唯一需要的是: swift_version:" 4.0.0"
这导致错误 - 没有它工作: 类型:"蒸汽"