web-dev-qa-db-ja.com

LoadError-クラスDigest :: SHA1のライブラリが見つかりません-digest / sha1

実行中pod installyogaのインストール時に問題が発生します。私のRuby環境に問題があるようです?

$ pod install
Analyzing dependencies
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `Permission-Camera` from `../node_modules/react-native-permissions/ios/Camera.podspec`
Fetching podspec for `Permission-LocationAlways` from `../node_modules/react-native-permissions/ios/LocationAlways.podspec`
Fetching podspec for `Permission-LocationWhenInUse` from `../node_modules/react-native-permissions/ios/LocationWhenInUse.podspec`
Fetching podspec for `RNPermissions` from `../node_modules/react-native-permissions`
Fetching podspec for `React` from `../node_modules/react-native/`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`

コマンド

/Users/User/.rbenv/versions/2.3.1/bin/pod install

スタック

   CocoaPods : 1.5.3
        Ruby : Ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
    RubyGems : 2.5.1
        Host : Mac OS X 10.15.1 (19B88)
       Xcode : 11.2.1 (11B500)
         Git : git version 2.24.0
Ruby lib dir : /Users/User/.rbenv/versions/2.3.1/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 7f8d90dc76a619c74dfe5b8d17317599f6175fc3

プラグイン

cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.1
cocoapods-try         : 1.1.0

Podfile

# Uncomment the next line to define a global platform for your project
 platform :ios, '9.0'

target 'default' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native/'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  # Pods for default
  pod 'GoogleIDFASupport'

  # Pods for ReactPushNotifications - Add these lines
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  pod 'Firebase/Storage'

  # Pods for react-native-permissions
  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
end

エラー

LoadError - library not found for class Digest::SHA1 -- digest/sha1
/Users/User/.rbenv/versions/2.3.1/lib/Ruby/2.3.0/digest.rb:16:in `const_missing'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-core-1.5.3/lib/cocoapods-core/specification.rb:566:in `checksum'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:641:in `block in generate_version_locking_dependencies'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:640:in `reject'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:640:in `generate_version_locking_dependencies'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:87:in `analyze'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:243:in `analyze'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:154:in `block in resolve_dependencies'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:153:in `resolve_dependencies'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:116:in `install!'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
/Users/User/.rvm/gems/Ruby-2.4.1@global/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
/Users/User/.rvm/gems/Ruby-2.4.1/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
/Users/User/.rbenv/versions/2.3.1/bin/pod:23:in `load'
/Users/User/.rbenv/versions/2.3.1/bin/pod:23:in `<main>'
3
Peter G.

私にとっては、一方的なシステムアップデートの後に問題が発生しました。

アンインストールRubyおよびそれを再インストールすると問題が解決しました:

rbenv uninstall 2.5.1
rbenv install 2.5.1
6
fguillen

Rubyバージョンに問題があります。最新をインストールしてください

brew install Ruby

以下のコマンドは以前のバージョンを上書きします

brew link --overwrite Ruby

このターミナルを閉じて新しいターミナルを開きます。バージョンを確認してください

Ruby -v

問題解決を確認するかどうか

Ruby -r digest/sha1 -e 'p Digest::SHA1'

予想される出力:Digest :: SHA1

1
Aurangzaib Rana