ios Pod安装不起作用,由于一些与Ruby相关的问题而失败

xa9qqrwz  于 2023-06-25  发布在  iOS
关注(0)|答案(3)|浏览(141)

我在终端中尝试:

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>'
rhfm7lfc

rhfm7lfc1#

错误消息是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
js5cn81o

js5cn81o2#

请尝试以下步骤:

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

mzmfm0qo3#

我在MacBook Pro M1系统上使用了这种方法。
在终端:

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

一切正常

相关问题