Devise中的LoadError :: RegistrationsController #create(无法加载此类文件–bcrypt_ext)。 为什么我会收到此错误?

我正在使用ruby 2.2.4。 我在安装Devise gem之后尝试注册时遇到此错误。 我曾经使用过ruby 2.1.5时从未遇到过这个错误。 ruby版本是错误的原因吗?

更新:这是我的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  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] 

设计3.5.6需要bcrypt <= 3.0,你可能有,但是某些版本的bcrypt不支持Windows上的特定版本的Ruby,这可能就是你所看到的。

这是我在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