swiftcompiler-errorsvaporbuild-settingsserver-side-swift

Swift Vapor Sample Not compiling


I'm trying to get my feet wet with server side swift, and specifically Swift Vapor by trying the Ray Wenderlich HelloVapor tutorial.

Basically performed the following steps so far using (my swift -version on Apple command prompt is Apple Swift version 4.1.2)

Here are the steps I've followed to setup Vapor and try the sample.

  1. On command prompt

enter image description here

  1. Open browser to https://brew.sh for instructions to setup homebrew (Copy and paste the following in a command prompt on terminal)

enter image description here

  1. Then run the following commands to install vapor and the vapor sample app HelloVapor in folder vaporsample.

enter image description here

  1. However when I try to build the run target I get the following compile errors:

enter image description here

It appears it cant find the modules. Or perhaps an incorrect version of swift (I am on Swift version 4.1.2 on my Mac). I'm confused and would like to seek the advise of the erudite crowd here.


Solution

  • Following a tip from @Marc (see comments) "You might do well to update to the current release Xcode 9.4.1 and say "yes" to the install the Xcode command tools on first launch. After an installation of the Xcode command lines tools you should no longer need to add Xcode to $PATH. In my case, I don't modify $PATH for any general (non-beta) Xcode release to get Vapor to build & run. – l --marc"

    I followed Marc's tip and the Vapor sample project buolt and ran with no issues in Xcode 9.4.1.

    Thanks Marc.