遇到pod install报错问题解决

xxxxx-Mac JumpDemoBB % pod install
Analyzing dependencies
Downloading dependencies
Installing SSZipArchive (2.4.3)
[!] Error installing SSZipArchive
[!] /usr/bin/git clone https://github.com/ZipArchive/ZipArchive.git /var/folders/5t/jt0_210j3kxftxbn6sfnjgpr0000gn/T/d20230706-20375-24g9va --template= --single-branch --depth 1 --branch 2.4.3
Cloning into '/var/folders/5t/jt0_210j3kxftxbn6sfnjgpr0000gn/T/d20230706-20375-24g9va'...
fatal: unable to access 'https://github.com/ZipArchive/ZipArchive.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

之前pod还好好的能正常install,但是今天突然报错了,想想应该是网络问题,在网上搜索了好些类似的问题,然后一一操作,终于解决了。
解决思路如下:

报了链接不上github.com,估计是hosts更换了,但是本地也没跟着替换导致连不上,所以从hosts文件修改入手。这个文件直接文本编辑器编辑提示没权限,要通过权限命令在vi编辑器编辑,但是我直接拷贝到桌面然后修改完在替换操作方便点。

hosts设置截图

\color{red}{最新的ip,我这边试了以下这3个关于github的能正常链接}

140.82.114.3  github.com
140.82.114.3  github.global.ssl.fastly.net
199.232.4.133  raw.githubusercontent.com
127.0.0.1  localhost
255.255.255.255  broadcasthost
做完以上操作,我试了下一个项目pod install可以了,但是换到另一个项目又报了以下错误,看着是trunk引起的问题,移除之前的trunk,执行了以下命令后我这边就ok了。

xxxxx-Mac codedemo % pod install
Analyzing dependencies
[!] CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/all_pods_versions_5_f_c.txt Response: Couldn't connect to server
xxxxx-Mac codedemo % pod repo remove trunk
Removing spec repo trunk

pod repo remove trunk

如遇到以上相同问题,希望能帮到你,good luck!

附上安装pod相关步骤

1.查看当前Mac电脑的brew.git 当前源

cd "$(brew --repo)" && git remote -v

2.查看当前homebrew-core.git 当前源

cd "$(brew --repo homebrew/core)" && git remote -v

3.将当前电脑homebrew镜像修改为阿里源

git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git

4. 修改 homebrew-core.git 为阿里源

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

5.zsh 替换 brew bintray 镜像(电脑终端是zsh的用这种)

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc

source ~/.zshrc

6.bash 替换 brew bintray 镜像(电脑终端是bash的用这种)

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile

source ~/.bash_profile

7. 刷新源

brew update

8.安装cocoapods

如果已经安装过可以用brew uninstall cocoapods 先卸载干净
再使用brew install cocoapods 安装cocoapods
安装完成之后,可使用 pod --version 查看当前版本

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容