Closed sfclub closed 6 years ago
@sfclub there's no web template for Vapor 3 yet. Create a new project with vapor new Hello --branch=beta
and then add Leaf and FluentPostgres to that.
The hanging issue is an issue with SPM where it can't resolve the dependencies.
ok. MacBook-Pro-sfclub:Hello1 sfclub$ cat Package.swift // swift-tools-version:4.0
import PackageDescription
let package = Package( name: "Hello1", dependencies: [ .package(url: "https://github.com/vapor/vapor.git", from: "3.0.0-rc.2"), //.package(url: "https://github.com/vapor/leaf.git", .branch("beta")), .package(url: "https://github.com/vapor/fluent-postgresql.git", from: "1.0.0-rc"), ], targets: [ .target( name: "App", dependencies: ["Async", "FluentPostgreSQL", "Vapor"] ), .target(name: "Run", dependencies: ["App"]), .testTarget(name: "AppTests", dependencies: ["App"]) ] )
:( sorry take my true way!
target( name: "App", dependencies: ["Async", "FluentPostgreSQL", "Vapor"] ),
should be
target( name: "App", dependencies: ["FluentPostgreSQL", "Vapor"] ),
You don't need Async as a dependency
ok. MacBook-Pro-sfclub:Hello1 sfclub$ cat Package.swift // swift-tools-version:4.0
import PackageDescription
let package = Package( name: "Hello1", dependencies: [ .package(url: "https://github.com/vapor/vapor.git", from: "3.0.0-rc.2"), //.package(url: "https://github.com/vapor/leaf.git", .branch("beta")), .package(url: "https://github.com/vapor/fluent-postgresql.git", from: "1.0.0-rc"), .package(url: "https://github.com/vapor/core.git", from: "3.0.0"), ], targets: [ .target( name: "App", dependencies: ["FluentPostgreSQL", "Vapor"] ), .target(name: "Run", dependencies: ["App"]), .testTarget(name: "AppTests", dependencies: ["App"]) ] )
MacBook-Pro-sfclub:Hello1 sfclub$ swift build -c release Fetching https://github.com/vapor/vapor.git Fetching https://github.com/vapor/tls.git Fetching https://github.com/apple/swift-nio-zlib-support.git Fetching https://github.com/vapor/validation.git Fetching https://github.com/vapor/console.git Fetching https://github.com/vapor/core.git Fetching https://github.com/vapor/crypto.git Fetching https://github.com/vapor/database-kit.git Fetching https://github.com/vapor/sockets.git Fetching https://github.com/vapor/routing.git Fetching https://github.com/vapor/fluent-postgresql.git Fetching https://github.com/vapor/service.git Fetching https://github.com/apple/swift-nio.git Fetching https://github.com/vapor/fluent.git Fetching https://github.com/apple/swift-nio-ssl-support.git Fetching https://github.com/vapor/template-kit.git Fetching https://github.com/vapor/async.git Fetching https://github.com/vapor/engine.git Fetching https://github.com/vapor/postgresql.git Fetching https://github.com/vapor/sql.git Fetching https://github.com/apple/swift-nio-ssl.git Cloning https://github.com/apple/swift-nio-ssl.git Resolving https://github.com/apple/swift-nio-ssl.git at 1.1.0 Cloning https://github.com/vapor/tls.git Resolving https://github.com/vapor/tls.git at 3.0.0-rc.1.0.1 Cloning https://github.com/apple/swift-nio-zlib-support.git Resolving https://github.com/apple/swift-nio-zlib-support.git at 1.0.0 Cloning https://github.com/vapor/validation.git Resolving https://github.com/vapor/validation.git at 2.0.0 Cloning https://github.com/vapor/console.git Resolving https://github.com/vapor/console.git at 3.0.2 Cloning https://github.com/vapor/core.git Resolving https://github.com/vapor/core.git at 3.1.6 Cloning https://github.com/vapor/database-kit.git Resolving https://github.com/vapor/database-kit.git at 1.0.1 Cloning https://github.com/vapor/crypto.git Resolving https://github.com/vapor/crypto.git at 3.1.1 Cloning https://github.com/vapor/sockets.git Resolving https://github.com/vapor/sockets.git at 3.0.0-rc.1 Cloning https://github.com/apple/swift-nio-ssl-support.git Resolving https://github.com/apple/swift-nio-ssl-support.git at 1.0.0 Cloning https://github.com/apple/swift-nio.git Resolving https://github.com/apple/swift-nio.git at 1.6.1 Cloning https://github.com/vapor/service.git Resolving https://github.com/vapor/service.git at 1.0.0 Cloning https://github.com/vapor/routing.git Resolving https://github.com/vapor/routing.git at 3.0.1 Cloning https://github.com/vapor/template-kit.git Resolving https://github.com/vapor/template-kit.git at 1.0.1 Cloning https://github.com/vapor/fluent-postgresql.git Resolving https://github.com/vapor/fluent-postgresql.git at 1.0.0-rc.2.2.1 Cloning https://github.com/vapor/fluent.git Resolving https://github.com/vapor/fluent.git at 3.0.0-rc.2.4.1 Cloning https://github.com/vapor/async.git Resolving https://github.com/vapor/async.git at 1.0.0-rc.1.1 Cloning https://github.com/vapor/postgresql.git Resolving https://github.com/vapor/postgresql.git at 1.0.0-rc.2.1 Cloning https://github.com/vapor/engine.git Resolving https://github.com/vapor/engine.git at 3.0.4 Cloning https://github.com/vapor/vapor.git Resolving https://github.com/vapor/vapor.git at beta Cloning https://github.com/vapor/sql.git Resolving https://github.com/vapor/sql.git at 1.0.0 Fatal error: Duplicate values for key: 'Async': file /BuildRoot/Library/Caches/com.apple.xbs/Binaries/swiftlang/install/TempContent/Objects/BNI_assert_lightweight/swift-macosx-x86_64/stdlib/public/core/8/HashedCollections.swift, line 8108 Illegal instruction: 4 MacBook-Pro-sfclub:Hello1 sfclub$
You don't need .package(url: "https://github.com/vapor/core.git", from: "3.0.0"),
Also Leaf doesn't have a beta branch, this is what you probably want
https://github.com/raywenderlich/vapor-til/blob/master/Package.swift
0xTim 10x. is work!
Awesome!
hi. vapor is cool! nice work! just started to take a vapor
brew install vapor
vapor new Hello --template=web
cd Hello
swift build -c releace >> fetching, Compile Swift Module, bla bla bla.... Linking ./.build/x86_64-apple-macosx10.10/release/Run
MacBook-Pro-sfclub:Hello sfclub$ ./.build/x86_64-apple-macosx10.10/release/Run The current hash key "0000000000000000" is not secure. Update hash.key in Config/crypto.json before using in production. Use
openssl rand -base64 <length>
to generate a random string. The current cipher key "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" is not secure. Update cipher.key in Config/crypto.json before using in production. Useopenssl rand -base64 32
to generate a random string. No command supplied, defaulting to serve... Starting server on 0.0.0.0:8080 All work fine!After that I try to connect the module "Fluent PostgreSQL" as written in the documentation https://docs.vapor.codes/3.0/postgresql/fluent/
Add lines to Package.swift: .package(url: "https://github.com/vapor/fluent-postgresql.git", from: "1.0.0-rc"), .target(name: "App", dependencies: ["FluentPostgreSQL", ...]),
swift package update Fetching https://github.com/vapor/fluent-postgresql.git Updating https://github.com/vapor/leaf-provider.git Updating https://github.com/vapor/vapor.git Updating https://github.com/vapor/multipart.git Updating https://github.com/vapor/core.git Updating https://github.com/vapor/node.git Updating https://github.com/vapor/crypto.git Updating https://github.com/vapor/console.git Updating https://github.com/vapor/engine.git Updating https://github.com/vapor/bcrypt.git Updating https://github.com/vapor/json.git Updating https://github.com/vapor/routing.git Updating https://github.com/vapor/random.git Updating https://github.com/vapor/debugging.git Updating https://github.com/vapor/bits.git Updating https://github.com/vapor/ctls.git Updating https://github.com/vapor/tls.git Updating https://github.com/vapor/sockets.git Updating https://github.com/vapor/leaf.git Fetching https://github.com/vapor/fluent.git Fetching https://github.com/vapor/postgresql.git Fetching https://github.com/vapor/async.git <- hangs on this line indefinitely
in the system monitor, the swift-build process is 100% using cpu one core. waited 2 days nothing changes. tell me what I'm doing wrong? found similar behavior but about mysql https://github.com/vapor/vapor/issues/1413