首页 > 解决方案 > 无法使用 Vapor 将 swift 包推送到 Heroku

问题描述

我正在尝试使用 Vapor buildpack(https://github.com/vapor-community/heroku-buildpack/tree/master)将 Swift 包推送到 Heroku,但我不断收到此错误:

error: terminated(1): /app/tmp/cache/heroku-18/swiftenv/versions/4.2/usr/bin/swift-build-tool -f /tmp/build_1041959f11306dce64ad9d4712e1d962/.build/debug.yaml main output:

我使用 Swift 5.2 编写包,但 Heroku 坚持使用 Swift 4.2。我已经确认 buildpack 与 Swift 5.2 兼容,并且我已将 .swift-version 文件以及我的 Package.swift 文件的第一行设置为 5.2。

这是 Package.swift 文件:

    // swift-tools-version:5.2
    // The swift-tools-version declares the minimum version of Swift required to build this package.

    import PackageDescription

    let package = Package(
name: "TurnipBot",
dependencies: [
    // Dependencies declare other packages that this package depends on.
    .package(url: "https://github.com/Azoy/Sword", .branch("master"))

],
targets: [
    // Targets are the basic building blocks of a package. A target can define a module or a test suite.
    // Targets can depend on other targets in this package, and on products in packages which this package depends on.
    .target(
        name: "TurnipBot",
        dependencies: ["Sword"]),
    .testTarget(
        name: "TurnipBotTests",
        dependencies: ["TurnipBot"]),
]
    )

标签: swiftherokudiscordvapor

解决方案


你确定提交.swift-version文件了吗?它拼写是否正确等?我已经在我的一个应用程序中使用它并且部署得很好


推荐阅读