Error after update Package.swift -->Add Leaf.git

Hello ,

I’m learning vapor swift til Chapter14 Templating with Leaf.
I have followed by the tutorial.
It can build and run the vapor project without any problem on my local pc .

Anyway, when I upload to the server and update Package.swift ,then build the project using below command on linux ubuntu server. It error like below.
I check the current swift version on the server.
It’s swift version 4.1 (swift-4.1-RELEASE).
I’m very appreciated if you could advise.

$Swift Package update
….
Updating GitHub - vapor/fluent: Vapor ORM (queries, models, and relations) for NoSQL and SQL databases
Updating GitHub - vapor/mysql-kit: 🐬 Pure Swift MySQL client built on non-blocking, event-driven sockets.
Updating GitHub - vapor/sql-kit: *️⃣ Build SQL queries in Swift. Extensible, protocol-based design that supports DQL, DML, and DDL.

$ vapor build
Building Project [Failed]

/root/practice/Sources/App/Models/Acronym.swift:51:17: error: value of type ‘SchemaCreator’ has no member ‘addReference’
try builder.addReference(from: .userID, to: \User.id)

Here is the update Package.swift of the project on the server

// swift-tools-version:4.1
import PackageDescription

let package = Package(
name: “TILApp6”,
dependencies: [
.package(url: “GitHub - vapor/vapor: 💧 A server-side Swift HTTP web framework.”, from: “3.0.0-rc”),
.package(url: “GitHub - vapor/fluent-mysql-driver: 🖋🐬 Swift ORM (queries, models, relations, etc) built on MySQL.”, from: “3.0.0-rc”),
.package(url: “GitHub - vapor/leaf: 🍃 An expressive, performant, and extensible templating language built for Swift.”, from: “3.0.0-rc”)
],
targets: [
.target(name: “App”, dependencies: [“FluentMySQL”, “Vapor”,“Leaf”]),
.target(name: “Run”, dependencies: [“App”]),
.testTarget(name: “AppTests”, dependencies: [“App”]),
]
)

Best Regards,
Thammaporn

The syntax has changed (I’m not sure if the deprecations were removed in Fluent 3.0) :thinking:

However, the new syntax is vapor-til/Acronym.swift at main · raywenderlich/vapor-til · GitHub

Thanks for the advice.
It solved the problem. ^^

1 Like