Rails加载错误-bcrypt的库版本不兼容 [英] Rails Load Error - incompatible library version for bcrypt

查看:134
本文介绍了Rails加载错误-bcrypt的库版本不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的rails srails c突然开始拒绝启动,并出现以下错误.我不记得要更新或删除任何宝石.在解决该问题方面提供的任何帮助都将受到赞赏.

My rails s and rails c has suddenly started refusing to boot up with the error below. I don't recall updating or deleting any gems. Any help in fixing the situation is greatly appreciated.

incompatible library version - /Users/[me]/projects/[app]/vendor/bundle/ruby/2.6.0/gems/bcrypt-3.1.12/lib/bcrypt_ext.bundle (LoadError)

bcrypt不是我们项目中明确需要的gem,但它包含在Gemfile.lock中,因为它是一个依赖项:bcrypt (3.1.12)

bcrypt is not an explicitly required gem in our project, but it's included in Gemfile.lock because it's a dependency: bcrypt (3.1.12)

到目前为止,我已经尝试了这些方法,但是出现了相同的错误:

So far I've tried these, but I get the same error:

  1. 在我的系统中卸载和安装bcrypt(根据此建议)
  1. Uninstalling and installing bcrypt in my system (according to this suggestion)

gem uninstall bcrypt -v 3.1.12

You have requested to uninstall the gem:
        bcrypt-3.1.12

sorcery-0.14.0 depends on bcrypt (~> 3.1)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled bcrypt-3.1.12

gem install bcrypt -v 3.1.12
Successfully installed bcrypt-3.1.12

  1. gem pristine --all

这是我检查gem版本后得到的结果:

Here are the results of what I get if I check the gem versions:

  1. gem info bcrypt

*** LOCAL GEMS ***
bcrypt (3.1.12)
    Author: Coda Hale
    Homepage: https://github.com/codahale/bcrypt-ruby
    License: MIT
    Installed at: /Users/[me]/.rvm/gems/ruby-2.6.2

    OpenBSD's bcrypt() password hashing algorithm.

  1. bundle info bcrypt

* bcrypt (3.1.12)
        Summary: OpenBSD's bcrypt() password hashing algorithm.
        Homepage: https://github.com/codahale/bcrypt-ruby
        Path: /Users/[me]/projects/[app]/vendor/bundle/ruby/2.6.0/gems/bcrypt-3.1.12

推荐答案

[已解决]

[解决方案1] ,我需要在vendor/bundle文件夹中卸载/重新安装gem,而不是执行gem uninstallgem install.

[Solution 1] I needed to uninstall/reinstall the gem in the vendor/bundle folder, instead of doing gem uninstall and gem install.

以下是其中涉及的步骤:

Here were the steps involved:

  1. 使用otool -L检查您的宝石保存在哪里(我的宝石保存在这里:[project root]/vendor/bundle/ruby/2.6.0/gems/bcrypt-3.1.12/lib/bcrypt_ext.bundle)

  1. Check where your gem is saved using otool -L (mine was saved here: [project root]/vendor/bundle/ruby/2.6.0/gems/bcrypt-3.1.12/lib/bcrypt_ext.bundle)

使用rm -rf删除bcrypt-3.1.12文件夹中的所有内容.

Remove everything in the bcrypt-3.1.12 folder with rm -rf.

bundle install --force --path vendor/bundle重新安装bcrypt-3.1.12 gem.

[解决方案2] ,我最终要做的是用bundle update bcrypt更新bcrypt的版本.猜测此更新可以在vendor/bundle中干净地安装了gem,因为我的所有rails命令都可以再次开始工作.

[Solution 2] What I ultimately ended up doing was to update bcrypt's version with bundle update bcrypt. Guessing this update installed the gem cleanly in vendor/bundle, because all my rails commands started working again.

bundle update bcrypt
Using bcrypt 3.1.13 (was 3.1.12)

希望这些技巧可以帮助将来遇到此问题的任何人!

Hope these tips help anyone who runs into this in the future!

这篇关于Rails加载错误-bcrypt的库版本不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆