当 运行 rails 时找不到订阅会员 gem 的图像

Image not found for patron gem when running rails

我在我的应用程序中尝试 运行 某些 rails 命令时遇到以下错误。

我将 ruby 2.6.6 升级到 2.7.3(我使用 rbenv)并从 2.0.2 捆绑到 2.1.4,方法是

 brew update && brew upgrade ruby-build
 rbenv install 2.7.3
 gem install bundler:2.1.4
 bundle install

现在,当我 运行 任何 rails 命令(例如:rails c)时,我得到这个错误:

/Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': dlopen(/Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/patron-0.13.3/lib/patron/session_ext.bundle, 9): Library not loaded: @rpath/libssh2.1.dylib
  Referenced from: /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/patron-0.13.3/lib/patron/session_ext.bundle
  Reason: image not found - /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/patron-0.13.3/lib/patron/session_ext.bundle (LoadError)
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `block in require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:291:in `load_dependency'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/patron-0.13.3/lib/patron/session.rb:6:in `<main>'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `block in require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:291:in `load_dependency'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/patron-0.13.3/lib/patron.rb:5:in `<main>'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:74:in `block (2 levels) in require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `each'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `block in require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `each'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler.rb:174:in `require'
    from /Users/asceta/Projects/Fintual/monolith/config/application.rb:10:in `<top (required)>'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:92:in `require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:92:in `preload'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:157:in `serve'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:145:in `block in run'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `loop'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `run'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
    from /Users/asceta/.rbenv/versions/2.7.3/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
    from -e:1:in `<main>'

我尝试过的:

  1. 这个.
  2. 重新安装 rbenv
  3. 使用 gem uninstall patron && gem install patron
  4. 手动卸载和安装赞助人 gem
  5. 使用 brew reinstall openssl@1.1
  6. 重新安装 openssl

当我从 GemfileGemfile.lock 中手动删除赞助人 gem 时一切正常,但我需要赞助人 [=46] =].

作为最后的措施,我尝试删除 rbenv 并使用 RVM:Ruby 版本管理器,但我想避免这种情况并继续使用 rbenv

接下来我会尝试的事情:

  • 运行 bundle exec rails c 代替。
  • 检查 which openssl returns,这可能表明您安装了不同的版本(我的显示 /usr/bin/openssl
  • 确保您正在从存储库目录中执行所有操作。