Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby: LoadError - library not found for class Digest::SHA1 -- digest/sha1

When running pod install it runs into a problem when installing yoga. Seems to be a problem with my ruby environment?

$ 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`

Command

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

Stack

   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

Plugins

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

Error

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>'
like image 744
Peter G. Avatar asked Nov 25 '19 14:11

Peter G.


3 Answers

For me the me problem started after an unsolicited system update.

Uninstalling ruby and installing it again solved the issue:

rbenv uninstall 2.5.1
rbenv install 2.5.1
like image 187
fguillen Avatar answered Nov 20 '22 00:11

fguillen


there is issue with ruby version. Install latest

brew install ruby

below command will overwrite the previous version

brew link --overwrite ruby

close this terminal and open new terminal.check your version

ruby -v

check issue resolve or not

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

expected output : Digest::SHA1

like image 5
Aurangzaib Rana Avatar answered Nov 20 '22 00:11

Aurangzaib Rana


Since this worked me, I am posting it as a comment.

After running

rbenv uninstall 2.5.1

if the below command is giving you an error (with ruby not installing)

rbenv install 2.5.1

maybe run this (for mac path)

RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2q rbenv install 2.3.5
like image 2
iCyborg Avatar answered Nov 19 '22 22:11

iCyborg