欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

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

程序员文章站 2023-12-20 13:07:28
cocoapods 出现loaderror - cannot load such file -- nanaimo错误解决办法 如果经常使用 cocoapods 进行个人类...

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 

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

上一篇:

下一篇: