Cocoa Pods'没有这样的文件或目录'错误

时间:2015-01-01 02:59:49

标签: objective-c cocoapods

我有一个使用cocoapods的IOS项目。在新计算机上切换计算机并更新操作系统后,当我尝试运行“pod update”时,我收到以下错误

Robbys-iMac-454:ios-v2 robbykmyers$ pod update
Update all pods
Analyzing dependencies
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `open': No such file or directory - /Users/robbykmyers/.cocoapods/repos (Errno::ENOENT)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `foreach'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `children'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/sources_manager.rb:63:in `all'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:130:in `repo_information'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:34:in `report'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:58:in `report_error'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:300:in `handle_exception'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:274:in `rescue in run'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:264:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:45:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/bin/pod:43:in `<top (required)>'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `<main>'

有谁知道如何解决这个问题?

3 个答案:

答案 0 :(得分:19)

  1. 使用~/.cocoapods/

  2. 删除文件夹rm -rf ~/.cocoapods
  3. 在终端输入pod setup命令。

  4. 此过程需要一段时间,因为此命令会将CocoaPods Specs存储库克隆到您计算机上的~/.cocoapods/

答案 1 :(得分:2)

有时在Podfile或Podspec

中使用错误的撇号字符时会发生这种情况

enter image description here

在OS X上使用标准的TextEdit应用程序时,这些撇号是默认的。我更喜欢Sublime Text以避免此类错误

答案 2 :(得分:0)

https://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/

rm -fr ~/Library/Caches/CocoaPods && \
gem update --system && \
gem update && \
gem cleanup && \
pod setup