执行 pod install 报错 Error installing libwebp

解决办法:

查看cocoapods 本地库路径:pod repo

$ pod repo
master
- Type: git (master)
- URL:  https://github.com/CocoaPods/Specs.git
- Path: /Users/ammk/.cocoapods/repos/master

在文件夹下找到libwebp的文件夹: find ~/.cocoapods/repos/master -iname libwebp

find ~/.cocoapods/repos/master -iname libwebp
输出
/Users/ammk/.cocoapods/repos/master/Specs/1/9/2/libwebp
复制代码

查看libwebp下版本:

$ cd ~/.cocoapods/repos/master/Specs/1/9/2/libwebp
$ ls -l
total 0
drwxr-xr-x  3 huanghaipo  staff   96  9  5  2017 0.4.1
drwxr-xr-x  3 huanghaipo  staff   96  9  5  2017 0.4.2
drwxr-xr-x  3 huanghaipo  staff   96  9  5  2017 0.4.3
drwxr-xr-x  3 huanghaipo  staff   96  9  5  2017 0.4.4
drwxr-xr-x  3 huanghaipo  staff   96  9  5  2017 0.5.0
drwxr-xr-x  3 huanghaipo  staff   96  9  5  2017 0.5.1
drwxr-xr-x  3 huanghaipo  staff   96  9  5  2017 0.5.2
drwxr-xr-x  3 huanghaipo  staff   96  9  5  2017 0.6.0
drwxr-xr-x  3 huanghaipo  staff   96  4 12  2018 0.6.1
drwxr-xr-x  3 huanghaipo  staff   96  2 14 17:59 1.0.0
drwxr-xr-x  3 huanghaipo  staff   96  5 29  2019 1.0.1
drwxr-xr-x  3 huanghaipo  staff   96  2 17 10:09 1.0.2
drwxr-xr-x  4 huanghaipo  staff  128  2 17 10:09 1.0.3
drwxr-xr-x  3 huanghaipo  staff   96  2 17 10:09 1.1.0
drwxr-xr-x  3 huanghaipo  staff   96  2 17 10:09 1.1.0-rc2
复制代码

cd到1.1.0版本,修改libwebp.podspec.json文件中的homepage,source->git

$ cd 1.1.0
$ ls -l
total 8
-rw-r--r--  1 huanghaipo  staff  1854  2 17 10:09 libwebp.podspec.json
复制代码

修改

$ sudo vim libwebp.podspec.json 
复制代码

homepage改为https://github.com/webmproject/,source->git改为https://github.com/webmproject/libwebp.git

"name": "libwebp",
  "version": "1.0.0",
  "summary": "Library to encode and decode images in WebP format.",
  "homepage": "https://developers.google.com/speed/webp/",
  "authors": "Google Inc.",
  "license": {
    "type": "BSD",
    "file": "COPYING"
  },
  "source": {
    "git": "https://chromium.googlesource.com/webm/libwebp",
    "tag": "v1.0.0"
  },
复制代码

修改完就大功告成,接下来cd到工程目录下,执行pod install

[图片上传失败...(image-dae11d-1647569280402)]

<figcaption></figcaption>

后面再次去执行pod install还是报上面的错误,检查master下的libwebp.podspec.json文件正常。那原因应该是多了trunk源,修改过 trunk后,还是有点问题,但是可以下载下来,最后执行 pod repo remove trunk删除trunk源,运行pod install 。OK

转载:https://juejin.cn/post/6844904089189351438

推荐阅读更多精彩内容