首页 > 系统服务 > 详细

在MacOS上创建一个 hello Vapor 后台项目

时间:2018-06-08 18:20:41      阅读:285      评论:0      收藏:0      [点我收藏+]

1. 查看当前环境

:~ user$ eval "$(curl -sL check.vapor.sh)"

正常情况

?  Xcode 9 is compatible with Vapor 2.
?  Xcode 9 is compatible with Vapor 3.
?  Swift 4.1 is compatible with Vapor 2.
?  Swift 4.1 is compatible with Vapor 3.

碰到的情况

?  Xcode 9 is compatible with Vapor 2.
?  Xcode 9 is compatible with Vapor 3.
2018-06-08 10:54:13.808 xcodebuild[91618:4860941] [MT] PluginLoading: Required plug-in compatibility UUID 426A087B-D3AA-431A-AFDF-F135EC00DE1C for plug-in at path ‘~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XAlign.xcplugin‘ not present in DVTPlugInCompatibilityUUIDs
2018-06-08 10:54:13.809 xcodebuild[91618:4860941] [MT] PluginLoading: Required plug-in compatibility UUID 426A087B-D3AA-431A-AFDF-F135EC00DE1C for plug-in at path ‘~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin‘ not present in DVTPlugInCompatibilityUUIDs
?  Swift 4.1 is compatible with Vapor 2.
?  Swift 4.1 is compatible with Vapor 3.

此处因为Xcode升级导致的插件失效,具体哪个暂时没有去关注,只找了修正的方法

:~ user$ find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/ -name Info.plist -maxdepth 3|xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add UUID

输入这条命令即可将uuid注入那个插件的info.plist,然后再按上面的流程查询就正常了

2. 下载 vapor

:~ user$ brew install vapor/tap/vapor

该命令可能会先 update brew,中间可能会有错误,具体情况具体分析

3. 上面完成了之后,切换到自己想要创建项目的文件夹后,敲入以下命令

:自己创建的文件夹 user$ vapor new HelloVapor --api --branch=beta

然后就会开始创建过程,需要一段时间,创建成功后会打印下面的图案

Cloning Template [Done]
Updating Package Name [Done]
Initializing git repository [Done]

                                       **
                                     **~~**
                                   **~~~~~~**
                                 **~~~~~~~~~~**
                               **~~~~~~~~~~~~~~**
                             **~~~~~~~~~~~~~~~~~~**
                           **~~~~~~~~~~~~~~~~~~~~~~**
                          **~~~~~~~~~~~~~~~~~~~~~~~~**
                         **~~~~~~~~~~~~~~~~~~~~~~~~~~**
                        **~~~~~~~~~~~~~~~~~~~~~~~~~~~~**
                        **~~~~~~~~~~~~~~~~~~~~~~~~~~~~**
                        **~~~~~~~~~~~~~~~~~~~~~++++~~~**
                         **~~~~~~~~~~~~~~~~~~~++++~~~**
                          ***~~~~~~~~~~~~~~~++++~~~***
                            ****~~~~~~~~~~++++~~****
                               *****~~~~~~~~~*****
                                  *************
                         
                         _       __    ___   ___   ___
                        \ \  /  / /\  | |_) / / \ | |_)
                         \_\/  /_/--\ |_|   \_\_/ |_| \
                           a web framework for Swift

                     Project "HelloVapor" has been created.
              Type `cd HelloVapor` to enter the project directory.
            Use `vapor cloud deploy` to host your project for free!
                                     Enjoy!

4. 接下来关联xcode

:HelloVapor user$ vapor xcode

打印如下信息

Generating Xcode Project [Done]
Select the `Run` scheme to run.
Open Xcode project?
y/n> y
Opening Xcode project...

上面手动选y,就会用xcode打开工程了,运行的时候只要当前主机的8080端口没有被占用,则可以正常运行啦

 

在MacOS上创建一个 hello Vapor 后台项目

原文:https://www.cnblogs.com/-WML-/p/9157026.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!