- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
几天来,我一直在尝试将 fluent-mysql 依赖项添加到我的 vapor 项目中,以便从项目中查询我单独的 mysql 数据库。但是我似乎总是会遇到某种错误,例如当我尝试 vapor update
它永远不会完成。 (过去我已经离开了几个小时),我也试过swift package update
但那有同样的错误。我现在处于 vapor update
的地步有效,但是我仍然遇到两个错误 'mysql/udf_registration_types.h' file not found with <angled> include; use "quotes" instead
和 Could not build Objective-C module 'CMySQL'
我从 vapor 网页模板中唯一改变的是 package.swift
现在是这样的:
import PackageDescription
let package = Package(
name: "iPadLocator",
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")),
.package(url: "https://github.com/vapor/fluent-mysql.git", .upToNextMajor(from: "2.0.0"))
],
targets: [
.target(
name: "App",
dependencies: ["Vapor", "LeafProvider", "MySQLDriver"],
exclude: ["Config", "Database", "Public", "Resources"]
),
.target(name: "Run", dependencies: ["App"]),
.testTarget(name: "AppTests", dependencies: ["App", "Testing"])
]
)
提前感谢您的任何帮助。这是我的第一个 stackOverflow 问题,很抱歉,如果它很糟糕。我在跑vapor Toolbox 3.1.7
和 Vapor framework 2.4.4
, 我都有 mysql
和 cmysql
已安装并且是最新的。
最佳答案
您想使用 Vapor 2 还是 Vapor 3? (忽略工具箱的版本)。如果您想要 Vapor 2,那么您拥有的是正确的 - 您只需将依赖项从 MySQLDriver
更改为 MySQLProvider
。
如果你想要 Vapor 3,那么你需要将所有依赖项更改为类似
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "TILApp",
dependencies: [
// 💧 A server-side Swift web framework.
.package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
.package(url: "https://github.com/vapor/fluent-mysql.git", from: "3.0.0"),
.package(url: "https://github.com/vapor/leaf.git", from: "3.0.0-rc"),
],
targets: [
.target(name: "App", dependencies: ["FluentMySQL", "Vapor", "Leaf"]),
.target(name: "Run", dependencies: ["App"]),
.testTarget(name: "AppTests", dependencies: ["App"]),
]
)
关于mysql - 将 FluentMySQL 与 vapor 3 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51609899/
几天来,我一直在尝试将 fluent-mysql 依赖项添加到我的 vapor 项目中,以便从项目中查询我单独的 mysql 数据库。但是我似乎总是会遇到某种错误,例如当我尝试 vapor updat
我是一名优秀的程序员,十分优秀!