问题
I'm using ruby 2.2.4. I get this error when I tried to sign up after installing the Devise gem. I never experienced this error when I used to use 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
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]
回答1:
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.
This is what I dug up on the 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
来源:https://stackoverflow.com/questions/35422463/loaderror-in-deviseregistrationscontrollercreate-cannot-load-such-file-bc