ios 无法添加URL为`https://cdn.cocoapods.org/`名为`trunk`的源

hgb9j2n6  于 2023-03-24  发布在  iOS
关注(0)|答案(6)|浏览(227)

我正在为iOS构建一个电容器应用程序。当我启动命令'npx cap sync ios'(启动pod install)时,我得到以下错误:

✖ Updating iOS native dependencies with "pod install" (may take several minutes): 
✖ update ios: 
[error] Error running update: Analyzing dependencies
Cloning spec repo `trunk` from `https://cdn.cocoapods.org/`
[!] Unable to add a source with url `https://cdn.cocoapods.org/` named `trunk`.
You can try adding it manually in `/Users/damien/.cocoapods/repos` or via `pod repo add`.

如果我执行建议:

pod repo add trunk https://cdn.cocoapods.org/

我得到这个错误

[!] Repo name `trunk` is reserved for CocoaPods' main spec repo accessed via CDN.

我在这个问题上被封锁了6个小时。我在互联网上阅读了所有提到这个错误的帖子。

nlejzf6q

nlejzf6q1#

临时解决方案:
我在我的Podfile顶部添加了'source ' https://github.com/CocoaPods/Specs.git '

platform :ios, '11.0'
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
....

但是下载我的Users/damien/.cocoapods/repos/文件夹中的所有repo(2.5gb)需要30分钟🤯

9cbw7uwe

9cbw7uwe2#

您可以使用以下命令还原trunk

pod repo add-cdn trunk https://cdn.cocoapods.org/

网址:https://github.com/CocoaPods/CocoaPods/issues/10078#issuecomment-696481185

vnjpjtjt

vnjpjtjt3#

另一种方法是让它在本地工作,因为这个CDN是一个问题

pod repo remove trunk

在Podfile中

source 'https://github.com/CocoaPods/Specs.git'

# source 'https://cdn.cocoapods.org/'

地址:https://github.com/CocoaPods/CocoaPods/issues/10078

nxagd54h

nxagd54h4#

我根据Logan在Github上说的话修复了它:

gem uninstall cocoapods
gem install cocoapods -v 1.8
pod install

1.9.1好像有bug什么的!

q3qa4bjr

q3qa4bjr5#

如果在Podfile中更改源代码后仍有问题:
source 'https://github.com/CocoaPods/Specs.git'
这是因为您需要删除当前的“trunk”并重新安装带有--repo-update的pod:

pod repo remove trunk
pod install --repo-update

--clean-install执行完全pod安装,忽略项目缓存的内容:

pod install --clean-install
o7jaxewo

o7jaxewo6#

我刚刚用sudo gem update解决了这个问题

相关问题