Fix issue "cannot load such file -- bcrypt_ext (LoadError)"

  sonic0002        2017-03-05 00:21:10       9,272        1    

bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project for hashing passwords. The bcrypt Ruby gem provides a simple wrapper for safely handling passwords.

However, sometimes the rails application would fail to start after installing the bcrypt gem on Windows. The error would look similar to below.

The issue is that it fails to load the bcrypt_ext which is the native built extension, the reason may be the library is wrongly built. To fix this issue, below steps can be followed. 

  1. Open a command console
  2. cd to the gem directory C:\RailsInstaller\Ruby2.2.0\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x86-mingw32\ext\mri
  3. Run ruby extconf.rb. It should create the Makefile
  4. Run make. It will build the extension libraries.
  5. Run make install

The whole process looks like

Now if you start your application, you should see the issue is gone.

RUBY  SOLUTION  RUBY ON RAILS  BCRYPT  LOAD ERROR 

       

  RELATED


  1 COMMENT


Anonymous [Reply]@ 2017-05-10 11:08:47

Getting this error:

C:\RailsInstaller\Ruby2.3.0\lib\ruby\gems\2.3.0\gems\bcrypt-3.1.11-x86-mingw32\ext\mri>ruby extconf.rb

creating Makefile

 

C:\RailsInstaller\Ruby2.3.0\lib\ruby\gems\2.3.0\gems\bcrypt-3.1.11-x86-mingw32\ext\mri>make

C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/make-0.3.1/bin/make:4:in `<top (required)>': undefined local variable or method `make' for main:Object (NameError)

        from C:/RailsInstaller/Ruby2.3.0/bin/make:22:in `load'

        from C:/RailsInstaller/Ruby2.3.0/bin/make:22:in `<main>'

 



  RANDOM FUN

True Ruby