很奇怪的遇到了这个问题,问题的具体出现流程如下:
我本地安装cocoapods1.1.1版本,然后pod update成功,但是同事电脑里是1.1.0版本,于是我让他升级下cocoapods,他并没有用pod repo update形式升级,而是直接下载了别人发布的版本文件然后进行覆盖,覆盖完了之后,本地显示1.1.1版本,接着悲剧来了,无论执行pod update还是pod install都报错
google之,碰到这个问题的人还真不少,都是卸载cocoapods然后重新安装,再pod setup,之后问题都得到了解决,但是我们试了好多遍,却并不能解决问题。这种情况下,冷静的分析问题才是解决问题的最好办法,于是好好的看报错信息,怀疑是ruby的问题,卸载重装之后,问题依旧!!!这究竟是什么引起的?没办法,只好一行一行的看报错,看到ruby parse error,怀疑是项目工程文件引起的,于是乎git查看记录,发现同事对工程文件有改动。其实解决这个问题之前问过他好多次,他都说没改。于是乎将工程文件还原,问题得到解决!!!
忙活了一上午,终于找到问题原因,也知道了如果工程文件被改动,pod update和pod install是可能出错导致无法编译的
附上出错信息
Analyzing dependencies
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
```
/Users/xxx/.rvm/gems/ruby-2.3.0/bin/pod install
```
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
CocoaPods : 1.1.1
Ruby : ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
RubyGems : 2.6.6
Host : Mac OS X 10.11.6 (15G1108)
Xcode : 8.0 (8A218a)
Git : git version 2.8.4 (Apple Git-73)
Ruby lib dir : /Users/xxx/.rvm/rubies/ruby-2.3.0/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ ac0f845aebbbd6785164dff6ec3598d8acb7d36d
```
### 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
```
### Podfile
from /Users/xxx/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/json/common.rb:156:in `parse'
from /Users/xxx/.rvm/gems/ruby-2.3.0/gems/gh_inspector-1.0.2/lib/gh_inspector/sidekick.rb:74:in `get_api_results'
from /Users/xxx/.rvm/gems/ruby-2.3.0/gems/gh_inspector-1.0.2/lib/gh_inspector/sidekick.rb:26:in `search'
from /Users/xxx/.rvm/gems/ruby-2.3.0/gems/gh_inspector-1.0.2/lib/gh_inspector/inspector.rb:65:in `search_query'
from /Users/xxx/.rvm/gems/ruby-2.3.0/gems/gh_inspector-1.0.2/lib/gh_inspector/inspector.rb:59:in `search_exception'
from /Users/xxx/.rvm/gems/ruby-2.3.0@global/gems/cocoapods-1.1.1/lib/cocoapods/user_interface/error_report.rb:119:in `search_for_exceptions'
from /Users/xxx/.rvm/gems/ruby-2.3.0@global/gems/cocoapods-1.1.1/lib/cocoapods/command.rb:65:in `report_error'
from /Users/xxx/.rvm/gems/ruby-2.3.0@global/gems/claide-1.0.1/lib/claide/command.rb:396:in `handle_exception'
from /Users/xxx/.rvm/gems/ruby-2.3.0@global/gems/claide-1.0.1/lib/claide/command.rb:337:in `rescue in run'
from /Users/xxx/.rvm/gems/ruby-2.3.0@global/gems/claide-1.0.1/lib/claide/command.rb:325:in `run'
from /Users/xxx/.rvm/gems/ruby-2.3.0@global/gems/cocoapods-1.1.1/lib/cocoapods/command.rb:50:in `run'
from /Users/xxx/.rvm/gems/ruby-2.3.0@global/gems/cocoapods-1.1.1/bin/pod:55:in `<top (required)>'
from /Users/xxx/.rvm/gems/ruby-2.3.0/bin/pod:22:in `load'
from /Users/xxx/.rvm/gems/ruby-2.3.0/bin/pod:22:in `<main>'
from /Users/xxx/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/xxx/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'