加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

在终端中运行Swift构建导致“平台路径”错误

发布时间:2020-12-14 05:22:57 所属栏目:百科 来源:网络整理
导读:我最近重新格式化了我的Mac.今天我尝试通过Terminal构建一个 swift可执行文件来启动服务器端swift项目.这是我用过的命令: swift包init –type可执行文件 快速构建 运行swift build后,我收到以下错误: xcrun: error: unable to lookup item 'PlatformPath'
我最近重新格式化了我的Mac.今天我尝试通过Terminal构建一个 swift可执行文件来启动服务器端swift项目.这是我用过的命令:

> swift包init –type可执行文件
>快速构建

运行swift build后,我收到以下错误:

xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'

我正在运行Xcode 8.3.1.

提前致谢!

尝试修复SDK路径(您的路径显示不正确):
$xcrun --show-sdk-path --sdk macosx

你可能有这个结果:

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

通过调用来切换默认的SDK位置:

$sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

如果这不起作用,那么看看(正常)SDK路径:

$ls -lat /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

您应该在该目录中看到SDK;如果没有,你需要下载它们.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读