美文网首页
cocoapods更新报错解决

cocoapods更新报错解决

作者: onlyyourself | 来源:发表于2017-03-28 10:19 被阅读24次
    • 执行 sudo gem install -n /usr/local/bin cocoapods 报错

    ERROR: While executing gem ... (Gem::DependencyError)

    Unable to resolve dependencies: cocoapods requires cocoapods-core (= 0.33.1), claide (~> 0.6.1), cocoapods-downloader (~> 0.6.1), cocoapods-plugins (~> 0.2.0), cocoapods-try (~> 0.3.0), cocoapods-trunk (~> 0.1.1), nap (~> 0.7)

    对于这种错误,最好直接删除当前的ruby,重新配置ruby环境

    • 更新cocoapod的时候会出现
      Performing a deep fetch of the master specs repo to improve future performance
      的错误。
      要等很久都装不好,建议直接结束。

    cocopods 删除原有 ruby 重新安装等解决方案
    1、淘宝的那个镜像(https://ruby.taobao.org/ )已经不可用了。所以我们现在用最新支持的ruby镜像(https://gems.ruby-china.org/)
    需要的命令行:
    $ gem sources -r https://rubygems.org/ (移除旧版本的镜像,如果你不知道你电脑上目前用的是什么镜像,可用 $ gem sources -l 来查看) $ gem sources -a https://gems.ruby-china.org/ (增加可用的镜像) $ gem sources -l (用来检查使用替换镜像位置成功)
    2、当pod setup 进入Setting up CocoaPods master repo 等待的时候表示正在下载了,此时你可通过新开一个终端窗口,输入"cd ~/.cocoapods/"命令行跳到cocoapods文件夹内,执行"du -sh *"查看正在下载的文件夹的大小
    2、创建Podfile
    转到项目根目录,vi Podfile,输入内容(因为本人建的项目为ios8.1版本):

    platform :ios, '9.0'
    
    target 'laila-employee' do
        use_frameworks!
    
        pod 'Masonry'
    
      target 'laila-employeeTests' do
        inherit! :search_paths
        # Pods for testing
      end
    
      target 'laila-employeeUITests' do
        inherit! :search_paths
        # Pods for testing
      end
    
    end
    

    保存。
    然后按Esc,并且输入 shift +“ :”号进入vim命令模式,然后在冒号后边输入wq 按回车键,保存并且退出。
    3、执行 pod install,稍等片刻

    相关文章

      网友评论

          本文标题:cocoapods更新报错解决

          本文链接:https://www.haomeiwen.com/subject/rrcsnttx.html