首页 > 解决方案 > rake db 创建中止

问题描述

我一直在尝试使用 Ruby 2.3.8 修复我的项目,我正在使用 rvm 安装 Ruby 2.3.8 但需要额外的工作才能在我的 Mac 上安装它,因为2.3.8需要无法使用openssl 1.1. 所以我需要找到如何安装openssl 1.0,因为 Homebrew 删除了,openssl 1.0所以它需要额外的研究来解决这个问题。

在我的项目中,我使用的是 MySQL 5.7,要安装 MySQL 5.7,我需要再次安装 OpenSSL 1.1,因此它会自动安装 OpenSSL 1.1

当我去我的项目并这样做时,rake db:create 我得到了这样的错误:

rake aborted!
LoadError: library not found for class Digest::SHA1 -- digest/sha1
/Users/hoomacbuk/Documents/mekari/quickbook/config/boot.rb:4:in `<top (required)>'
/Users/hoomacbuk/Documents/mekari/quickbook/config/application.rb:1:in `<top (required)>'
/Users/hoomacbuk/Documents/mekari/quickbook/Rakefile:4:in `<top (required)>'
/Users/hoomacbuk/.rvm/gems/ruby-2.3.8/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'

Caused by:
LoadError: dlopen(/Users/hoomacbuk/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/x86_64-darwin18/digest/sha1.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /Users/hoomacbuk/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/x86_64-darwin18/digest/sha1.bundle
  Reason: image not found - /Users/hoomacbuk/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/x86_64-darwin18/digest/sha1.bundle
/Users/hoomacbuk/Documents/mekari/quickbook/config/boot.rb:4:in `<top (required)>'
/Users/hoomacbuk/Documents/mekari/quickbook/config/application.rb:1:in `<top (required)>'
/Users/hoomacbuk/Documents/mekari/quickbook/Rakefile:4:in `<top (required)>'
/Users/hoomacbuk/.rvm/gems/ruby-2.3.8/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'

当我运行时,我bin/rake db:create再次收到此错误:

/Users/hoomacbuk/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/digest.rb:16:in `const_missing': library not found for class Digest::SHA1 -- digest/sha1 (LoadError)

如何让 Ruby 2.3.x 运行?一世

标签: ruby-on-railsrubyopensslrubygems

解决方案


您的 ruby​​ 版本似乎有问题。

卸载当前版本并重新安装相同的版本,然后重试。

rvm uninstall 2.3.8

进而

rvm install 2.3.8

推荐阅读