Vapor 4 叶 - 未能解决依赖性
Vapor 4 leaf - failed to resolve dependency
在使用终端创建一个新的 vapor 项目 vapor new someProjectName
之后,同时还添加了 fluent 和 postgres 作为我的数据库...一切顺利,但是,在手动添加 leaf 之后我收到 无法解析依赖项 错误,这是我的 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"),
])
]
)
一定是我添加的 leaf 依赖有误,而且在查看了 vapor 的文档后他们也没有更新他们的文档......如果你知道这个问题的答案请告诉我。谢谢!
Leaf 仍在 RC 中,这就是为什么您很遗憾找不到任何关于它的信息。
将版本设置为 4.0.0-rc
它应该可以工作
在使用终端创建一个新的 vapor 项目 vapor new someProjectName
之后,同时还添加了 fluent 和 postgres 作为我的数据库...一切顺利,但是,在手动添加 leaf 之后我收到 无法解析依赖项 错误,这是我的 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"),
])
]
)
一定是我添加的 leaf 依赖有误,而且在查看了 vapor 的文档后他们也没有更新他们的文档......如果你知道这个问题的答案请告诉我。谢谢!
Leaf 仍在 RC 中,这就是为什么您很遗憾找不到任何关于它的信息。
将版本设置为 4.0.0-rc
它应该可以工作