Pod安装不工作,由于一些ruby相关问题而失败

jvidinwx  于 2023-06-22  发布在  Ruby
关注(0)|答案(3)|浏览(164)

在终端中尝试:

pod install

回复:

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.bundle' (no such file), '/Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) - /Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.bundle (LoadError)
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.rb:13:in `<top (required)>'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/yaml.rb:4:in `<top (required)>'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/sources_manager.rb:6:in `<top (required)>'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/core_overrides.rb:1:in `<top (required)>'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods.rb:77:in `<module:Pod>'
        from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods.rb:17:in `<top (required)>'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/bin/pod:36:in `<top (required)>'
        from /usr/local/bin/pod:23:in `load'
        from /usr/local/bin/pod:23:in `<main>'
gmxoilav

gmxoilav1#

错误消息是Ruby安装和YAML依赖项之间的兼容性问题。尝试以下步骤:

  • brew install libyaml
  • brew install rbenv
  • 通过将以下内容添加到您的shell配置文件中,在您的shell中设置rbenv
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
  • 安装所需的Ruby版本rbenv install 2.6.8
  • 将已安装的Ruby版本设置为全局默认值。rbenv global 2.6.8
  • 通过运行安装bundler。gem install bundler
  • 更新您的CocoaPods安装gem install cocoapods
  • 然后再次运行pod install
crcmnpdw

crcmnpdw2#

请尝试以下步骤:

brew install libyaml
brew reinstall ruby
gem uninstall psych
gem install psych
pod install

请让我知道你在你的情况下有什么错误。

n3ipq98p

n3ipq98p3#

这种方法对我很有效。Apple M1 Pro系统
在终端:

curl -L https://get.rvm.io | bash -s stable

source ~/.rvm/scripts/rvm

rvm install ruby-2.7.2

sudo gem install cocoapods

然后重新启动终端

pod init

它工作正常。

相关问题