我的报错
### Command
```
/usr/local/bin/pod install
```
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
CocoaPods : 1.11.3
Ruby : ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
RubyGems : 3.0.3.1
Host : macOS 12.4 (21F79)
Xcode : 13.4 (13F17a)
Git : git version 2.32.1 (Apple Git-133)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
```
### Plugins
```
cocoapods-deintegrate : 1.0.5
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.1
cocoapods-trunk : 1.6.0
cocoapods-try : 1.2.0
```
### Podfile
```ruby
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
install! 'cocoapods', :deterministic_uuids => false
target 'AwesomeProject' do
config = use_native_modules!
# Flags change depending on the env values.
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'AwesomeProjectTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
```
### Error
```
JSON::ParserError - 416: unexpected token at '{
"name": "CppBridge",
"header_dir": "CppBridge",
"dependencies": {
"Flipper": [
"~>0.125.0"
]
},
"compiler_flags": "-DDEBUG=1 -DFLIPPER_OSS=1 -DFB_SONARKIT_ENABLED=1 -DFOLLY_HAVE_BACKTRACE=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_HAVE_LIBGFLAGS=0 -DFOLLY_HAVE_LIBJEMALLOC=0 -DFOLLY_HAVE_PREADV=0 -DFOLLY_HAVE_PWRITEV=0 -DFOLLY_HAVE_TFO=0 -DFOLLY_USE_SYMBOLIZER=0",
"source_files": "iOS/FlipperKit/CppBridge/**/*.{h}",
"private_header_files": "iOS/FlipperKit/CppBridge/**/*.h",
"preserve_paths": "iOS/FlipperKit/CppBridge/**/*.h",
"pod_target_xcconfig": {
"USE_HEADERMAP": "NO",
"ONLY_ACTIVE_ARCH": "YES",
"DEFINES_MODU'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/json/common.rb:156:in `parse'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/json/common.rb:156:in `parse'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/specification.rb:748:in `from_string'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/specification.rb:722:in `from_file'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source.rb:188:in `specification'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver/lazy_specification.rb:37:in `specification'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver/lazy_specification.rb:29:in `subspec_by_name'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:362:in `block in specifications_for_dependency'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:362:in `map'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:362:in `specifications_for_dependency'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:165:in `search_for'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:267:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:267:in `sort_by'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:267:in `sort_by!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:60:in `block in sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:288:in `push_initial_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:210:in `start_resolution'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:168:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:416:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:161:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
```
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=416%3A+unexpected+token+at+%27%7B%0A++++++%22name%22%3A+%22CppBridge%22%2C%0A++++++%22header_dir%22%3A+%22CppBridge%22%2C%0A++++++%22dependencies%22%3A+%7B%0A++++++++%22Flipper%22%3A+%5B%0A++++++++++%22~%3E0.125.0%22%0A++++++++%5D%0A++++++%7D%2C%0A++++++%22compiler_flags%22%3A+%22-DDEBUG%3D1+-DFLIPPER_OSS%3D1+-DFB_SONARKIT_ENABLED%3D1+-DFOLLY_HAVE_BACKTRACE%3D1+-DFOLLY_HAVE_CLOCK_GETTIME%3D1+-DFOLLY_NO_CONFIG+-DFOLLY_MOBILE%3D1+-DFOLLY_USE_LIBCPP%3D1+-DFOLLY_HAVE_LIBGFLAGS%3D0+-DFOLLY_HAVE_LIBJEMALLOC%3D0+-DFOLLY_HAVE_PREADV%3D0+-DFOLLY_HAVE_PWRITEV%3D0+-DFOLLY_HAVE_TFO%3D0+-DFOLLY_USE_SYMBOLIZER%3D0%22%2C%0A++++++%22source_files%22%3A+%22iOS%2FFlipperKit%2FCppBridge%2F%2A%2A%2F%2A.%7Bh%7D%22%2C%0A++++++%22private_header_files%22%3A+%22iOS%2FFlipperKit%2FCppBridge%2F%2A%2A%2F%2A.h%22%2C%0A++++++%22preserve_paths%22%3A+%22iOS%2FFlipperKit%2FCppBridge%2F%2A%2A%2F%2A.h%22%2C%0A++++++%22pod_target_xcconfig%22%3A+%7B%0A++++++++%22USE_HEADERMAP%22%3A+%22NO%22%2C%0A++++++++%22ONLY_ACTIVE_ARCH%22%3A+%22YES%22%2C%0A++++++++%22DEFINES_MODU%27&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
Searching for inspections failed: undefined method `map' for nil:NilClass
?官方这个不是很正确,我没有装镜像开代理也不能成功。可能是科学上网还不够科学吧
我的解决方法是换源
可以先用这个方法不行,再进行下面的操作
CocoaPods | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source MirrorCocoaPods 使用帮助 | 镜像站使用帮助 | 清华大学开源软件镜像站,致力于为国内和校内用户提供高质量的开源软件镜像、Linux 镜像源服务,帮助用户更方便地获取开源软件。本镜像站由清华大学 TUNA 协会负责运行维护。https://mirror.tuna.tsinghua.edu.cn/help/CocoaPods/
1、查看源
gem sources -l
2、更换源
sudo gem update --system
gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.com/
出现这个的结果就说明OK了
*** CURRENT SOURCES ***
https://gems.ruby-china.com/
3、clone?CocoaPods仓库
git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git ~/.cocoapods/repos/trunk
如果报这个错误,文件重复pod执行不了。就需要手动安装了
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:
'Specs/5/1/1/Governor/1.0.11-APPS-1582-beta11/Governor.podspec.json'
'Specs/5/1/1/Governor/1.0.11-apps-1582-beta11/Governor.podspec.json'
执行下面命令查看是否完成
pod search AFNetworking
4、将神秘代码放入Podfile文件第一行
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
5、在ios文件夹下输入 pod install
这个样子就OK了,yarn ios 试试看吧
手动安装
1、在github上下载cocoapod文件 下载地址:https://github.com/CocoaPods/Specs 文件大小应该在500M左右,发现下载太慢可以去码云下载 码云地址https://gitee.com/mirrors/CocoaPods-Specs 2、把下载的文件文件夹名改为trunk,并放在路径~/.cocoapods/repos下 3、下载git隐藏文件夹 下载地址:https://github.com/ShaeZhuJiu/CocoaPadHiddenFileGit.git 4、把.git.zip解压缩然后将.git隐藏文件放在~/.cocoapods/repos/trunk路径下
mac隐藏文件夹显示方法:Command+Shift+. 可以显示隐藏文件、文件夹,再按一次,恢复隐藏;
?
|