今天要用pod管理三方代码 突然发现报了这个问题:
/Library/Ruby/Site/2.0.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.0.0/rubygems.rb:298:in `activate_bin_path'
from /usr/local/bin/pod:22:in `<main>'
然后更新下ruby环境发现一直提示:
Latest version currently installed. Aborting.
一直就不可以,于是上网查了下,说淘宝的Gems源停止更新了。
替换成ruby-china的镜像。
步骤:
1. 查看现在镜像源 :gem source
2. 删除淘宝镜像 :gem source --remove https://ruby.taobao.org/
3. 添加ruby-china的镜像源: gem source -a https://gems.ruby-china.org/
4. 安装pod: gem install cocoapods
5. 输入密码 等待安装成功
6. 初始化pod:pod setup 等待完成就ok了
参考:更换ruby官方源到非taboo源的另一源:ruby-china源方法
2、pod search xxx 时候提示
[!] Unable to find a pod with name, author, summary, or description matching `FMDB`
只需要在终端输入:
rm ~/Library/Caches/CocoaPods/search_index.json
再次去search 就好了
3、
-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
只需要在终端输入:
sudo gem install -n /usr/local/bin cocoapods
就ok了
网友评论