`在 REPL 中创建目标 Swift AST 上下文时出错:(null)`
`Error creating target Swift AST context: (null)` in REPL
我在这里看到了几个(好吧,不是很多,但有几个)关于 SO 处理这个错误的问题,但是 none 提出的解决方案对我有用。这就是我得到的
$ swift
Welcome to Apple Swift version 2.1.1 (swiftlang-700.1.101.15 clang-700.1.81). Type :help for assistance.
warning: Swift error in module repl_swift:
Error creating module Swift AST context: couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.
warning: Swift error in module dyld:
Error creating module Swift AST context: couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.
warning: Swift error in module CoreFoundation:
Error creating module Swift AST context: couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.
...
warning: Swift error in module ServiceManagement:
Error creating module Swift AST context: couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.
warning: Swift error in module libxslt.1.dylib:
Error creating module Swift AST context: couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.
error: Error creating target Swift AST context: (null)
这可能是在我发出一些我不记得的命令后发生的,也可能没有发生(我的 bash 历史记录也没有太大帮助)。奇怪的是,如果我卸载 Xcode,REPL 就会开始正常工作。但是,如果我重新安装 Xcode,错误又会出现。顺便说一下,我在 Xcode 7.2.1 (7C1002)。想法?
要查看您当前的 Xcode 路径:
xcode-select -p
我的是一条老路:
/Applications/Xcode.app/Contents/Developer
然后通过以下方式更新此路径:
sudo xcode-select -s /Library/Developer/CommandLineTools
我在这里看到了几个(好吧,不是很多,但有几个)关于 SO 处理这个错误的问题,但是 none 提出的解决方案对我有用。这就是我得到的
$ swift
Welcome to Apple Swift version 2.1.1 (swiftlang-700.1.101.15 clang-700.1.81). Type :help for assistance.
warning: Swift error in module repl_swift:
Error creating module Swift AST context: couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.
warning: Swift error in module dyld:
Error creating module Swift AST context: couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.
warning: Swift error in module CoreFoundation:
Error creating module Swift AST context: couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.
...
warning: Swift error in module ServiceManagement:
Error creating module Swift AST context: couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.
warning: Swift error in module libxslt.1.dylib:
Error creating module Swift AST context: couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.
error: Error creating target Swift AST context: (null)
这可能是在我发出一些我不记得的命令后发生的,也可能没有发生(我的 bash 历史记录也没有太大帮助)。奇怪的是,如果我卸载 Xcode,REPL 就会开始正常工作。但是,如果我重新安装 Xcode,错误又会出现。顺便说一下,我在 Xcode 7.2.1 (7C1002)。想法?
要查看您当前的 Xcode 路径:
xcode-select -p
我的是一条老路:
/Applications/Xcode.app/Contents/Developer
然后通过以下方式更新此路径:
sudo xcode-select -s /Library/Developer/CommandLineTools