在使用终端创建一个新的蒸汽项目vapor new someProjectName
,同时添加 fluent 和 postgres 作为我的数据库之后......一切顺利,但是,在手动添加叶子后,我得到一个无法解决依赖 错误的错误,这就是我的 Package.swift 文件:
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "someProjectName",
platforms: [
.macOS(.v10_15)
],
dependencies: [
// A server-side Swift web framework.
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/fluent.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/fluent-postgres-driver.git", from: "2.0.0"),
.package(url: "https://github.com/vapor/leaf.git", from: "3.0.0"),
],
targets: [
.target(
name: "App",
dependencies: [
.product(name: "Fluent", package: "fluent"),
.product(name: "FluentPostgresDriver", package: "fluent-postgres-driver"),
.product(name: "Vapor", package: "vapor"),
.product(name: "Leaf", package: "leaf")
],
swiftSettings: [
// Enable better optimizations when building in Release configuration. Despite the use of
// the `.unsafeFlags` construct required by SwiftPM, this flag is recommended for Release
// builds. See <https://github.com/swift-server/guides#building-for-production> for details.
.unsafeFlags(["-cross-module-optimization"], .when(configuration: .release))
]
),
.target(name: "Run", dependencies: [.target(name: "App")]),
.testTarget(name: "AppTests", dependencies: [
.target(name: "App"),
.product(name: "XCTVapor", package: "vapor"),
])
]
)
一定是我错误地添加了叶子依赖项,并且在查看了蒸汽的文档后,他们也没有更新他们的文档……如果你知道这个问题的答案,请告诉我。谢谢!