简体   繁体   中英

vapor build command not working with Swift 3.0

I am currently following the small and brief introduction to Swift Vapor by following their "Hello World" tutorial on their website. However I keep getting an error from swift-package when I try to build the project where it shows the following.

$ vapor build
No .build folder, fetch may take a while...
Fetching Dependencies [Failed]
Error: swift-package: error: unknown command: --enable-prefetching

I cannot seem to find out how to resolve this online. Anybody have any idea?

you have not mentioned your environment, so i'm giving solution for macOS.

I had the same issue, my swift version is 3.0.2 and vapor toolbox version is 1.0.9, I tried the following thing to make it work

  1. get into your project directory

  2. create xcode project with command

     swift package generate-xcodeproj 
  3. open xcode project

  4. Select your scheme as App like this

在此处输入图片说明

  1. and then build and run app

hope this helps!!

Make sure that you're using the correct command line tools for the Swift Version that you're using.

You can check from Xcode > Preferences > Locations > Command Line Tools

For me, using swift 3.0.2, vapor build command doesn't work neither. However using swift 3.1.0, vapor build command works well. My Vapor toolbox version is v1.1.0

I had the same problem, and I had Swift 3.1 installed. I deleted old version completely and installed new one and now it's building fine.

Try

    rm -rf /usr/local/bin/vapor
    brew tap vapor/homebrew-tap
    


than

brew install vapor

or

brew link vapor

if you have installed a new version previously.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM