简体   繁体   English

LoadError(无法加载此类文件-bcrypt)

[英]LoadError (cannot load such file — bcrypt)

Is anyone facing this issue: 是否有人面临这个问题:

LoadError (cannot load such file -- bcrypt)

in a Rails 5 application ? 在Rails 5应用程序中?

My model is like that: 我的模型是这样的:

class User < ApplicationRecord
    validates :name, presence: true, uniqueness: true
      has_secure_password
end

I have bundle installed bcrypt (which is in my Gemfile). 我已捆绑安装bcrypt(位于我的Gemfile中)。 I'm able to require it in irb, but my rails application is getting this error. 我可以在irb中要求它,但是我的rails应用程序遇到此错误。

I'm using Mac OS X Sierra and Ruby 2.3.1. 我正在使用Mac OS X Sierra和Ruby 2.3.1。

I ran into the same error and restarted the server to get it to work like Black Enigma said. 我遇到了同样的错误,然后重新启动了服务器,使其像Black Enigma所说的那样工作。 ie after running bundle install in the terminal, exit out of the server you're running on then run rails server again. 例如,在终端中运行bundle install后,退出正在运行的服务器,然后再次运行rails server Works fine now. 现在工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM