首页 > 系统 > iOS > 正文

CocoaPods 出现LoadError - cannot load such file -- nanaimo错误解决办法

2020-07-26 02:51:10
字体:
来源:转载
供稿:网友

CocoaPods 出现LoadError - cannot load such file -- nanaimo错误解决办法

如果经常使用 CocoaPods 进行个人类库的提交和更新,那么肯定会遇到这样的一个错误。如题:LoadError - cannot load such file -- nanaimo,翻译过来就是 LoadError - 无法加载此类文件 - nanaimo。该错误产生的时机一般是在验证 .podspec 文件的时候。具体的错误呈现形式是这样的:

benpaobaodeiMac-2:WZYUnlimitedScrollView bpb$ pod lib lint   -> WZYUnlimitedScrollView  MARKDOWN TEMPLATE   ### Command  ``` /usr/local/bin/pod lib lint ```  ### Report  * What did you do?  * What did you expect to happen?  * What happened instead?   ### Stack  ```   CocoaPods : 1.2.0.beta.1     Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]   RubyGems : 2.0.14.1     Host : Mac OS X 10.12.1 (16B2555)     Xcode : 8.2.1 (8C1002)      Git : git version 2.10.1 (Apple Git-78) Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib Repositories : master - https://github.com/CocoaPods/Specs.git @ 3d3d5f5d2fbb80e043adfd3ad3357a10845cf349 ```  ### Plugins  ``` cocoapods-deintegrate : 1.0.1 cocoapods-plugins   : 1.0.0 cocoapods-search   : 1.0.0 cocoapods-stats    : 1.0.0 cocoapods-trunk    : 1.1.1 cocoapods-try     : 1.1.0 ```  ### Error  ``` LoadError - cannot load such file -- nanaimo /Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.4.1/lib/xcodeproj/project.rb:353:in `block in save' /Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.4.1/lib/xcodeproj/project.rb:353:in `open' /Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.4.1/lib/xcodeproj/project.rb:353:in `save' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/validator.rb:412:in `create_app_project' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/validator.rb:300:in `block in perform_extensive_analysis' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/validator.rb:295:in `each' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/validator.rb:295:in `perform_extensive_analysis' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/validator.rb:79:in `validate' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/command/lib/lint.rb:62:in `block in run' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/command/lib/lint.rb:50:in `each' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/command/lib/lint.rb:50:in `run' /Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/command.rb:50:in `run' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0.beta.1/bin/pod:55:in `<top (required)>' /usr/local/bin/pod:23:in `load' /usr/local/bin/pod:23:in `<main>' ```   TEMPLATE END   [!] Oh no, an error occurred.  Search for existing GitHub issues similar to yours: https://github.com/CocoaPods/CocoaPods/search?q=cannot+load+such+file+--+nanaimo&type=Issues  If none exists, create a ticket, with the template displayed above, on: https://github.com/CocoaPods/CocoaPods/issues/new  Be sure to first read the contributing guide for details on how to properly submit a ticket: https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md  Don't forget to anonymize any private data!  Looking for related issues on cocoapods/cocoapods...  - LoadError - cannot load such file -- nanaimo   https://github.com/CocoaPods/CocoaPods/issues/6281 [closed] [12 comments]   2 days ago   - help!  cannot load such file -- nanaimo   https://github.com/CocoaPods/CocoaPods/issues/6312 [closed] [6 comments]   6 weeks ago   - LoadError - cannot load such file -- nanaimo   https://github.com/CocoaPods/CocoaPods/issues/6214 [closed] [30 comments]   4 weeks ago  and 10 more at: https://github.com/cocoapods/cocoapods/search?q=cannot%20load%20such%20file%20--%20nanaimo&type=Issues&utf8=✓ 

上述错误,可以有两种方式进行解决。大家可以分别尝试,总有一种适合你。

方式一,重新安装 CocoaPods 的类库。

先清空 CocoaPods 的缓存:

$ sudo rm -rf ~/.cocoapods/repos/master $ sudo rm -fr ~/Library/Caches/CocoaPods/ 

再重新安装 CocoaPods 的类库:

$ pod setup 

注意,细心的童鞋可能发现。上面两行清楚缓存的语句不太一样。分别是 rm -rf 和 rm -fr,它们其实是没有区别的,表示强制(f:不提示)删除文件和目录(r:删除)

但方式一可能用起来不会那么顺畅,该错误产生的大多数原因还是应该用方式二来解决。

方式二,对 nanaimo 进行删除并重新加载

$ sudo gem uninstall nanaimo $ sudo gem install nanaimo 

运行上面两行代码的结果:

benpaobaodeiMac-2:WZYUnlimitedScrollView bpb$ sudo gem uninstall nanaimo Password:  Select gem to uninstall:  1. nanaimo-0.2.2  2. nanaimo-0.2.3  3. All versions > 3 Successfully uninstalled nanaimo-0.2.2  You have requested to uninstall the gem:   nanaimo-0.2.3  xcodeproj-1.4.1 depends on nanaimo (~> 0.2.0) If you remove this gem, these dependencies will not be met. Continue with Uninstall? [yN] y Successfully uninstalled nanaimo-0.2.3 benpaobaodeiMac-2:WZYUnlimitedScrollView bpb$ sudo gem install nanaimo Fetching: nanaimo-0.2.3.gem (100%) Successfully installed nanaimo-0.2.3 Parsing documentation for nanaimo-0.2.3 Installing ri documentation for nanaimo-0.2.3 1 gem installed 

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表