简体   繁体   English

无法安装 cocoapods

[英]Unable to install cocoapods

Hi I am learning React Native, I was able to build Android version successfully but here in the iOS version I am facing so many issues.嗨,我正在学习 React Native,我能够成功构建 Android 版本,但是在 iOS 版本中,我遇到了很多问题。 I'm developing a Podcast application for both Android and iOS but when I'm trying to install cocoapods in my Application I am getting the following error,我正在为 Android 和 iOS 开发 Podcast 应用程序,但是当我尝试在我的应用程序中安装cocoapods时出现以下错误,

Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
        ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/json-2.3.1/ext/json/ext/generator
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20201214-42573-vm30sv.rb extconf.rb
creating Makefile

current directory: /Library/Ruby/Gems/2.6.0/gems/json-2.3.1/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.6.0/gems/json-2.3.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
         ^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: note: did not find header 'config.h' in framework 'ruby' (loaded from '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks')
1 error generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/json-2.3.1 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/json-2.3.1/gem_make.out

Hardware: Mac Mini硬件:Mac Mini

Can anyone help me in solving this issue.谁能帮我解决这个问题。 I'd like to install it with sudo gem install cocoapods rather than brew我想用sudo gem install cocoapods而不是brew安装它

You should not use Apple's Ruby installation.您不应使用 Apple 的 Ruby 安装。 That installation exists solely for internal use by Apple itself.该安装仅供Apple 内部使用。

Since you have specified in your question that you want to use Apple's Ruby installation, I am afraid there is nothing that can be done to fix the problem.由于您已在问题中指定要使用 Apple 的 Ruby 安装,因此恐怕无法解决此问题。

If, on the other hand, you are willing to use a different Ruby installation (installed by hand , with Homebrew , with ruby-install , with ruby-build , with RVM , asdf , or any other way), then the problem should not present itself in the first place.另一方面,如果您愿意使用不同的 Ruby安装手动安装,使用Homebrew ,使用ruby-install ,使用 ruby -build ,使用RVMasdf或任何其他方式),那么问题不应该把自己摆在首位。

For more information, see for example有关详细信息,请参阅例如

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM