when I try to run migrations in terminal I am getting error with vapor toolbox -18.0.0.
My Code in configure.swift
public func configure(_ app: Application) throws {
// uncomment to serve files from /Public folder
// app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
app.databases.use(.postgres(hostname: "localhost", username: "postgres", password: "", database: "mydatabase"), as: .psql)
app.migrations.add(CreateMovie())
// register routes
try routes(app)
}
My Code in Migrations
struct CreateMovie: Migration {
func prepare(on database: Database) -> EventLoopFuture<Void> {
database.schema("movies") //tablename
.id()
.field("title", .string) //column name
.create()
}
//undo
func revert(on database: Database) -> EventLoopFuture<Void> {
database.schema("movies").delete()
}
}
following is the output.
HomeMBP:vaporize-me username$ vapor run migrate
Updating https://github.com/vapor/fluent-kit.git
Updating https://github.com/apple/swift-metrics.git
Updating https://github.com/apple/swift-nio-extras.git
Updating https://github.com/vapor/postgres-nio.git
Updating https://github.com/vapor/fluent.git
Updating https://github.com/swift-server/async-http-client.git
Updating https://github.com/vapor/async-kit.git
Updating https://github.com/apple/swift-log.git
Updating https://github.com/vapor/websocket-kit.git
Updating https://github.com/swift-server/swift-backtrace.git
Updating https://github.com/vapor/fluent-postgres-driver.git
Updating https://github.com/vapor/sql-kit.git
Updating https://github.com/apple/swift-crypto.git
Updating https://github.com/apple/swift-nio.git
Updating https://github.com/vapor/postgres-kit.git
Updating https://github.com/vapor/routing-kit.git
Updating https://github.com/vapor/console-kit.git
Updating https://github.com/vapor/vapor.git
Updating https://github.com/apple/swift-nio-http2.git
Updating https://github.com/apple/swift-nio-ssl.git
error: terminated(128): PWD=/Users/username/Learning/vaporize-me XPC_SERVICE_NAME=0 __CF_USER_TEXT_ENCODING=0x1F7:0x0:0x0 LC_CTYPE=UTF-8 GIT_SSH_COMMAND=ssh -oBatchMode=yes SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk SHLVL=1 _=/usr/local/bin/vapor TERM_PROGRAM=Apple_Terminal LIBRARY_PATH=/usr/local/lib PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin HOME=/Users/username SECURITYSESSIONID=186a6 XPC_FLAGS=0x0 LOGNAME=username TMPDIR=/var/folders/pw/nx75wvr9177bygn9s6gr9gl80000gq/T/ LaunchInstanceID=8E492B00-D02E-4F8C-8622-E24E55DB8162 TERM=xterm-256color USER=username OLDPWD=/Users/username TERM_SESSION_ID=3F21BA5B-F0B0-49FF-9E0E-66445430473A GIT_TERMINAL_PROMPT=0 CPATH=/usr/local/include SHELL=/bin/bash SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.wN5DP9iUWU/Listeners TERM_PROGRAM_VERSION=433 git -C /Users/username/Learning/vaporize-me/.build/repositories/vapor-2c13b66e remote update -p output:
fatal: cannot change to '/Users/username/Learning/vaporize-me/.build/repositories/vapor-2c13b66e': No such file or directory
Fatal error: result 1: file /private/tmp/vapor-20200707-2429-1rpgdhn/toolbox-18.0.0/Sources/VaporToolbox/exec.swift, line 55
Illegal instruction: 4
I did some research on my own but couldn't find any solution.
Please Help!!!!
That looks like you have an invalid
Package.resolved
file. You can fix this by runningswift package update
before building your project, or just deleting youPackage.resolved
file.