如何解决 Rails 错误:找不到图像 - ../digest/md5.bundle

Posted

技术标签:

【中文标题】如何解决 Rails 错误:找不到图像 - ../digest/md5.bundle【英文标题】:How to solve Rails error: Image not found - ../digest/md5.bundle 【发布时间】:2021-02-01 23:46:17 【问题描述】:

这可能与openssl有关。我在 LibreSSL 2.8.3 上。这会导致问题吗?

无论如何,我使用的任何 rails 命令,例如 rails -v 或 rails new,都会向我抛出这些错误:

Traceback (most recent call last):
23: from /Users/Laurens/.rbenv/versions/2.6.4/bin/rails:23:in `<main>'
22: from /Users/Laurens/.rbenv/versions/2.6.4/bin/rails:23:in `load'
21: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/exe/rails:10:in `<top (required)>'
20: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
19: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
18: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/cli.rb:18:in `<top (required)>'
17: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/command.rb:44:in `invoke'
16: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/command.rb:70:in `find_by_namespace'
15: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/command/behavior.rb:39:in `lookup'
14: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/command/behavior.rb:39:in `each'
13: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/command/behavior.rb:40:in `block in lookup'
12: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/command/behavior.rb:40:in `each'
11: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/command/behavior.rb:44:in `block (2 levels) in lookup'
10: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
 9: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
 8: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/commands/application/application_command.rb:4:in `<top (required)>'
 7: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
 6: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
 5: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/generators/rails/app/app_generator.rb:3:in `<top (required)>'
 4: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
 3: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
 2: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/generators/app_base.rb:4:in `<top (required)>'
 1: from /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

/Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/Laurens/.rbenv/版本/2.6.4/lib/ruby/2.6.0/x86_64-darwin19/digest/md5.bundle,9):库未加载:/usr/local/opt/openssl/lib/libssl.1.0.0.dylib(加载错误) 引用自:/Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/x86_64-darwin19/digest/md5.bundle 原因:找不到图像 - /Users/Laurens/.rbenv/versions/2.6.4/lib/ruby/2.6.0/x86_64-darwin19/digest/md5.bundle

有人知道如何解决这个问题吗?

提前致谢!

【问题讨论】:

【参考方案1】:

使用 rbenv rbenv install 2.6.0 重新安装 ruby​​,因为 libssl 1.0.0.已从您的系统中删除,您当前的安装将无法运行。

【讨论】:

我刚试过。不幸的是,我仍然遇到同样的错误。有没有办法手动让它指向不同版本的 libssl?对不起,我对这一切都很陌生。它告诉我我安装了 LibreSSL 2.8.3。 重装 Rails gem 后解决。

以上是关于如何解决 Rails 错误:找不到图像 - ../digest/md5.bundle的主要内容,如果未能解决你的问题,请参考以下文章

Rails 服务器说找不到图像

如何解决错误“找不到图像”?

Rails 路线有时找不到错误

Ruby Rails在HTTP GET请求中找不到404

如何使用Paperclip在Rails 4中上传多个图像

Rails 3.1 和 Coffeescript 出现“找不到变量”错误