REPL 中的“创建目标 Swift AST 上下文时出错:(null)”

2024-01-24

我在这里看到了几个(好吧,不是那么多,而是几个)关于处理此错误的问题,但所提出的解决方案都不适合我。这就是我得到的

$ 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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

REPL 中的“创建目标 Swift AST 上下文时出错:(null)” 的相关文章

随机推荐