当我尝试在终端中运行以下命令:pod setup --verbose或pod install时,终端向我返回此错误:
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:118:in `git_version': Failed to extract git version from `git --version` ("xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\n") (RuntimeError)
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:130:in `verify_minimum_git_version!'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:49:in `run'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:22:in `load'
from /usr/local/bin/pod:22:in `<main>'
我该如何解决?
答案 0 :(得分:0)
该错误意味着您没有安装Xcode命令行工具,或者您最近更改/重命名了Xcode位置,并且旧链接已损坏。
为了修复它,您可以运行以下命令:
class DateDemo2 : DateDemo {
var eventsDateTimes3 : [Date]?
required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
eventsDateTimes3 = try container.decode([Date]?.self, forKey: .eventsDateTimes3)
try super.init(from: decoder)
}
private enum CodingKeys: String, CodingKey {
case eventsDateTimes3
}
}
必须将上面的/Applications/Xcode.app替换为Xcode安装位置的路径。请注意,系统将提示您安装Xcode命令行工具。
答案 1 :(得分:0)
当我将Mac OS版本从10.15升级到11 时,我发现了同样的问题。
造成该问题的原因是,您需要更新Xcode命令行工具。
我通过在终端中使用以下命令修复了该问题
xcode-select --install