我尝试从命令行运行Vapor应用程序的迁移。基本命令swift run App
似乎不起作用。下面是一个典型的测试,比较旧的语法。
danieldonaldson@Daniels-Mac-mini wb2-web % vapor run migrate
This command is deprecated. Use `swift run App` instead.
Error: Invalid URL: /Volumes/500 GB Current/Current Work/wb2-web/Package.swift
danieldonaldson@Daniels-Mac-mini wb2-web % swift run App migrate
error: no executable product named 'App'
字符串
Package.swift文件位于Active Directory中,并且似乎使用名称“App”。
targets: [
.target(
name: "App",
dependencies: [
.product(name: "Vapor", package: "vapor"),
.product(name: "FluentPostgresDriver", package: "fluent-postgres-driver"),
.product(name: "Fluent", package: "fluent"),
.product(name: "Leaf", package: "leaf"),
// .product(name: "SendGrid", package: "sendgrid"),
],
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))
]
),
型
虽然在顶部,名称是不同的:
let package = Package(
name: "Authentication",
platforms: [
.macOS(.v10_15)
],
型
但这是一个已经在几年的地方的名称,没有变化已作出.我不通常迁移或恢复手动,但在这种情况下,我必须测试一些东西.所以我不知道什么时候突然出现,但我确实需要检查这个.
为什么swift找不到应用程序的可执行文件?我相信这是相当标准的Vapor做法。
1条答案
按热度按时间lfapxunr1#
在Package.swift中,您有一个
.target
和一个.executableTarget.
Recent Vapor 4版本a,它查看的是executableTarget
名称,而不是target
名称。很可能您的executableTarget
名称是'Run',因此只需使用字符串