【问题标题】:Cocoapods: LoadError - no such file to loadCocoapods:LoadError - 没有要加载的文件
【发布时间】:2013-11-09 13:43:33
【问题描述】:

我正在尝试向我的 Xcode 项目添加一个 pod。我收到此错误:

LoadError - 没有要加载的文件 -- xcodeproj/prebuilt/universal-darwin13.0-1.8.7/xcodeproj_ext /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in gem_original_require' /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in require' /Library/Ruby/Gems/1.8/gems/xcodeproj-0.14.0/lib/xcodeproj/ext.rb:6 /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in gem_original_require' /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in require' /Library/Ruby/Gems/1.8/gems/xcodeproj-0.14.0/lib/xcodeproj/project.rb:4 /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/installer/analyzer.rb:488:in compute_target_platforms' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/installer/analyzer.rb:485:in each' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/installer/analyzer.rb:485:in compute_target_platforms' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/installer/analyzer.rb:55:in analyze' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/installer.rb:171:in analyze' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/installer.rb:94:in resolve_dependencies' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/user_interface.rb:52:in section' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/installer.rb:93:in resolve_dependencies' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/installer.rb:86:in install!' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/command/project.rb:38:in run_install_with_update' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/command/project.rb:68:in run' /Library/Ruby/Gems/1.8/gems/claide-0.3.2/lib/claide/command.rb:206:in run' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/lib/cocoapods/command.rb:51:in run' /Library/Ruby/Gems/1.8/gems/cocoapods-0.27.1/bin/pod:19 /usr/bin/pod:23:in load' /usr/bin/pod:23

我的 podfile 内容:

pod 'RestKit', '~> 0.21.0'

任何帮助将不胜感激!

【问题讨论】:

  • 它只包含那个吗?
  • 是的,也尝试过提供平台..但它仍然有效。
  • 以前用过吗?

标签: ios iphone xcode cocoapods podfile


【解决方案1】:

从 macOS 10.8 升级到 10.9 后,已安装的 CocoaPods gem 不再工作,即使重新安装 gem。要解决此问题,您可能需要先卸载 gem,然后重新安装。

  1. $ gem uninstall cocoapods
  2. $ gem install cocoapods

【讨论】:

    【解决方案2】:

    在运行命令 pod install 之前,不会考虑添加到 pod 中的文件,但不会考虑它们的引用。只需运行以下命令:

    pod install

    【讨论】:

      【解决方案3】:

      如下,这是我的问题: /usr/local/Cellar/ruby/2.5.0_2/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': 无法加载这样的文件——Xcodeproj (LoadError)

      来自 /usr/local/Cellar/ruby/2.5.0_2/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'

      来自 Script/ModuleDiscover.rb:9:in `'

      尝试了很多方法,都没有用,最后我解决了下面的问题:

      1、command + q,退出xcode

      2、打开终端和“open -a xcode”。一切都好

      【讨论】:

        【解决方案4】:

        如果您使用的是 10.10 并看到此错误 (/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:)试试这个

        Open Xcode 6 > Preferences > Locations
        Command Line Tools version to Xcode 6.0
        Uninstall cocoapods/xcodeproj then re-install.
        
        sudo gem uninstall cocoapods
        sudo gem uninstall xcodeproj
        sudo gem install xcodeproj
        sudo gem install cocoapods
        
        pod --version 
        

        【讨论】:

          【解决方案5】:

          终于找到了解决方案:我在同一台机器上运行旧 Xcode4 和新 Xcode5 并执行相同的项目。在某些时候我似乎丢失了命令行工具(和 iPhone5 模拟器)。

          重新安装命令行工具为我解决了这个问题。由于 Xcode 4.6.3 菜单项 Xcode - Preferences - Downloads - Components 出于未知原因不再有命令行工具,这里有另一种安装方式:

          xcode-select --install
          
          --install
                    Opens a user interface dialog to request automatic installation of the
                    command line developer tools.
          

          现在运行“pod install”效果很好。

          【讨论】:

            【解决方案6】:

            我也看到了这个。运行这个解决了这个问题:

            sudo gem install cocoapods && pod install
            

            【讨论】:

            • 对我来说它没有解决问题:(我刚刚将我们的构建服务器升级到小牛,现在 Jenkins 在再次构建和安装 cocoapods 时显示此错误并没有解决它
            猜你喜欢
            • 2011-04-08
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多