Cocoapods没有这样的文件加载错误

时间:2013-10-30 05:31:50

标签: ios iphone xcode file cocoapods

我正在尝试将pod添加到我的xcode项目中。我收到了这个错误:

  

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每个'   /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 /斌/荚:23

我的podfile内容:

pod 'RestKit', '~> 0.21.0'

任何帮助将不胜感激!

6 个答案:

答案 0 :(得分:16)

我也看到了这个。运行此操作修复了问题:

sudo gem install cocoapods && pod install

答案 1 :(得分:4)

终于找到了一个解决方案:我在同一台机器上运行旧的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”工作正常。

答案 2 :(得分:3)

如果您使用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 

答案 3 :(得分:0)

如下,这是我的问题: /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:在`'

只是尝试了很多方法,并没有用,最终我解决了问题:

1,命令+ q,退出xcode

2,打开终端和"打开-a xcode"。一切都很好

答案 4 :(得分:0)

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

pod install

答案 5 :(得分:0)

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

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