简体   繁体   English

Devise :: RegistrationsController#create中的LoadError(无法加载此类文件— bcrypt_ext)。 为什么会出现此错误?

[英]LoadError in Devise::RegistrationsController#create (cannot load such file — bcrypt_ext). Why do I get this error?

I'm using ruby 2.2.4. 我正在使用ruby 2.2.4。 I get this error when I tried to sign up after installing the Devise gem. 安装Devise gem后尝试注册时出现此错误。 I never experienced this error when I used to use ruby 2.1.5. 我以前使用ruby 2.1.5时从未遇到此错误。 Is the ruby version the cause of the error here? 红宝石版本是导致错误的原因吗?

UPDATE: this is what my gemfile looks like and I'm using Windows 7 Professional 64-bit 更新:这是我的gemfile的样子,我正在使用Windows 7 Professional 64位

source 'https://rubygems.org'


gem 'rails', '4.2.5.1'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'simple_form', '~> 3.2', '>= 3.2.1'
gem 'country_select', '~> 2.5', '>= 2.5.1'
gem 'devise', '~> 3.5', '>= 3.5.6'

group :doc do
    gem 'sdoc', '~> 0.4.0'
end


group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Devise 3.5.6 needs bcrypt <= 3.0, which you probably have, but some versions of bcrypt were not supported with specific versions of Ruby on Windows, which is probably what you're seeing. Devise 3.5.6需要bcrypt <= 3.0,您可能已经拥有了,但是特定版本的Windows上的Ruby不支持某些版本的bcrypt,这可能就是您所看到的。

This is what I dug up on the bcrypt github repo : 这是我在bcrypt github repo上挖出的:

1) Launch a terminal session
2) Enter gem uninstall bcrypt
3) Enter gem uninstall bcrypt-ruby
4) Enter gem install bcrypt --platform=ruby
5) Edit your gemfile to include the following line:
   gem 'bcrypt-ruby', '3.1.5', :require => 'bcrypt'
6) Run bundle install

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

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