mac电脑 pod install时候遇到的一些问题
===========问题1============================
Mac 系统更新到 macOS Catalina 10.15 之后 发现pos install 报错
-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad
解决:
粗暴点,直接重装
sudo gem install cocoapods
执行后还是报错
ERROR: Could not find a valid gem 'cocoapods' (>= 0) in any repository
-------------------分割线-------------------------------------
输入这段命令行就好了,输入后会执行一堆操作等着就好,然后直接pod install就成功了
sudo gem install cocoapods --source http://rubygems.org
参考
https://blog.csdn.net/liwenjie0912/article/details/102390598
https://blog.csdn.net/piyixia/article/details/96484677
===========问题2============================
cocopads更新库时失败,报错Failed to extract git version from ' git --version ' xcrun: error: invalid active developer path
最近 升级了一下电脑系统 macOSMojave 10.14.1
顺便升级了一下 Xcode Version 10.1 (10B61)
哭了 使用 cocosPods 集成时 报错
Mac:~mac$ pod-versionTraceback(most recent call last):5:from/usr/local/bin/pod:23:in`
分析:
Failed to extract git version from ' git --version ' xcrun: error: invalid active developer path
未能从git—version中提取 git 版本: 错误: 无效的活动开发路径;简单来说就是Git工具不好使了。
通常做法就是打开 terminal 执行 xcode-select --install
但由于我是 macOS 升级 所以这样是不行的,需要到 Git 官网下载 Git 才可以:
https://git-scm.com/download/mac
下载完成后手动安装 git 这样就可以解决了 !
链接:https://www.jianshu.com/p/c882c8ffa79c
-------------------------------------------------------
!!!以上方法网慢始终下载失败,最后在终端直接打这个命令执行完安装就ok了
命令行执行: xcode-select --install解决问题 . 重要的话说三遍!!!
==========问题3============================
问题描述
[!] Error installing Masonry
[!] /usr/bin/git clone https://github.com/cloudkite/Masonry.git /var/folders/0f/n8wwqx_166588q2rhp__r2wc0000gn/T/d20210313-14531-h9zipp --template= --single-branch --depth 1 --branch v1.1.0
Cloning into '/var/folders/0f/n8wwqx_166588q2rhp__r2wc0000gn/T/d20210313-14531-h9zipp'...
fatal: unable to access 'https://github.com/cloudkite/Masonry.git/': Failed to connect to github.com port 443: Operation timed out
试了各种方法都没有效果
只有下边这个方法解决了该问题
需要在finder 前往文件夹 打开 /etc/hosts 文件,然后复制到本地
打开浏览器放入该链接
http://tool.chinaz.com/dns/?type=1&host=github.com&ip=
aaaaaa
然后复制到 hosts文件里 后面 加上 github.com 如下
bbbbbb
保存 然后 复制文件到 etc/hosts 覆盖掉
重新打开终端 cd到当前目录 执行 pod install
作者链接:https://www.jianshu.com/p/869b2325bb74
==========问题4============================
pod安装某个三方库时候,失败,看原因貌似时依赖某个指定版本
解决方法:删除.workspace和.lock文件,重新执行podinstall
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "Masonry":
In snapshot (Podfile.lock):
Masonry (= 1.1.0)
In Podfile:
HYBMasonryAutoCellHeight was resolved to 2.0.1, which depends on
Masonry (~> 0.6)
Masonry
[!] Smart quotes were detected and ignored in your Podfile. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.