vapor-community / mongo-driver

MongoDB driver for Fluent
28 stars 26 forks source link

SwiftPM cannot resolve #59

Closed kimsanov closed 5 years ago

kimsanov commented 5 years ago

Xcode 11 Beta 6. When adding package gives error:

The package dependency graph can not be resolved, possibly because of these requirements: https://github.com/vapor-community/mongo-driver — 2.3.1..<3.0.0

vzsg commented 5 years ago

Can you share your whole Package.swift file?

kimsanov commented 5 years ago

My current Package is

// swift-tools-version:4.0
import PackageDescription

let package = Package(
    name: "Kimsapp-Stats",
    dependencies: [
        // 💧 A server-side Swift web framework.
        .package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
        // 🍃 An expressive, performant, and extensible templating language built for Swift.
        .package(url: "https://github.com/vapor/leaf.git", from: "3.0.0"),
        .package(url: "https://github.com/vapor/fluent-postgresql.git", from: "1.0.0-rc")
    ],
    targets: [
        .target(name: "App", dependencies: ["Leaf", "Vapor", "FluentPostgreSQL"]),
        .target(name: "Run", dependencies: ["App"]),
        .testTarget(name: "AppTests", dependencies: ["App"])
    ]
)

But I've also tried with new vapor project from web template. Result is the same. Here is Package.swift for empty project

// swift-tools-version:4.0
import PackageDescription

let package = Package(
    name: "TestMongo",
    dependencies: [
        // 💧 A server-side Swift web framework.
        .package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),

        // 🍃 An expressive, performant, and extensible templating language built for Swift.
        .package(url: "https://github.com/vapor/leaf.git", from: "3.0.0"),
    ],
    targets: [
        .target(name: "App", dependencies: ["Leaf", "Vapor"]),
        .target(name: "Run", dependencies: ["App"]),
        .testTarget(name: "AppTests", dependencies: ["App"])
    ]
)

Here is screenshot how error looks Screenshot 2019-09-03 at 14 09 13

kimsanov commented 5 years ago

When I manually add to Packege.swift .package(url: "https://github.com/vapor-community/mongo-driver", from: "2.3.1")

and call vapor fetch --verbose

It stucks after line with sqlite

vapor fetch --verbose Fetching Dependencies ... warning: 'fetch' command is deprecated; use 'resolve' instead Updating https://github.com/vapor/http.git Updating https://github.com/vapor/multipart.git Updating https://github.com/vapor/leaf.git Updating https://github.com/apple/swift-nio-ssl-support.git Updating https://github.com/vapor/console.git Updating https://github.com/vapor/routing.git Updating https://github.com/vapor/template-kit.git Updating https://github.com/apple/swift-nio-ssl.git Updating https://github.com/vapor/core.git Updating https://github.com/vapor/crypto.git Updating https://github.com/vapor/service.git Updating https://github.com/apple/swift-nio.git Updating https://github.com/vapor/database-kit.git Updating https://github.com/vapor/validation.git Updating https://github.com/apple/swift-nio-zlib-support.git Updating https://github.com/vapor/vapor.git Updating https://github.com/vapor/websocket.git Fetching https://github.com/vapor-community/mongo-driver Updating https://github.com/vapor/url-encoded-form.git Fetching https://github.com/vapor/fluent.git Fetching https://github.com/OpenKitten/MongoKitten.git Fetching https://github.com/vapor/node.git Fetching https://github.com/vapor/random.git Fetching https://github.com/vapor/sqlite.git

vzsg commented 5 years ago

The problem is that this package is only compatible with Vapor 2, and you're trying to add it to a Vapor 3 project. There's no workaround, you will have to ignore this package and use MongoKitten 5 directly.

kimsanov commented 5 years ago

Got it. Thanks!