1

I am using the gem of devise and I am getting error LoadError in Devise::RegistrationsController#create cannot load such file -- bcrypt_ext.. I tried to do some research regarding to this problem and also tried to follow the instruction given(https://stackoverflow.com/questions/35422463/loaderror-in-deviseregistrationscontrollercreate-cannot-load-such-file-bc)

But still having this problem. Any suggestion?

NOTE: The guide that I am using is video guide and I am using ruby on rails on windows 7

Gem File

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end
# error in devise
gem 'bcrypt-ruby', '~> 3.1', '>= 3.1.5'
# Bundle for authentication
gem 'devise', '~> 4.2', '>= 4.2.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.0.rc1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', github: "rails/sass-rails"

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '~> 2.13.0'
  gem 'selenium-webdriver'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Community
  • 1
  • 1
Angel
  • 966
  • 4
  • 25
  • 60
  • Uncomment the line `# gem 'bcrypt', '~> 3.1.7'` and run `bundle install` – max Apr 18 '17 at 00:07
  • I checked my gem, and it is now listed bcrypt (3.1.11 ruby x86-mingw32) bcrypt-ruby (3.1.5 x86-mingw32) and I also restart the serverf – Angel Apr 18 '17 at 00:18
  • Wups, right now I cant run the rails server because it gives me this error "C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0.rc1/lib/active_support/dependencies.rb:292:in `require': cannot load such file -- bcrypt_ext (LoadError) " – Angel Apr 18 '17 at 00:29
  • 1
    @Angel this may help http://stackoverflow.com/questions/33588735/loaderror-cannot-load-such-file-bcrypt-ext-on-windows-2008-x64-server – yatindra rao Apr 18 '17 at 04:15

2 Answers2

2

I was also having the same error, and my problem got fixed, please try solution 3

The problem is the compiled windows gem. It would be better if it were deleted and only include the pure ruby version.

Solution one:

You can copy bcrypt_ext.so from \lib\2.1 to \lib the same folder where is bcrypt.rb

Solution two:

You can use the gem install bcrypt --platform=ruby even if I had trouble to select that from rails which it always use the compiled version

Solution three:

git clone https://github.com/codahale/bcrypt-ruby.git

cd bcrypt-ruby

gem build bcrypt.gemspec

gem install gem-compiler

gem compile bcrypt-3.1.10.gem

gem install bcrypt-3.1.10-x64-mingw32.gem --local

Dnyanarth lonkar
  • 869
  • 7
  • 12
  • In my case on Windows 7 64bit I had the *bcrypt-3.1.11.gem* and *bcrypt-3.1.11-x86-mingw32.gem* which I used in your **Solution three**, that worked for me. Thanks! – Roan Aug 19 '17 at 08:10
1

Please do one thing and it will solve your problem

remove the version and rest just write this in your Gemfile

gem 'bcrypt-ruby'
nitanshu verma
  • 261
  • 3
  • 8