Fix issue "cannot load such file -- bcrypt_ext (LoadError)"
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.
- Open a command console
- 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
- Run ruby extconf.rb. It should create the Makefile
- Run make. It will build the extension libraries.
- Run make install
The whole process looks like
Now if you start your application, you should see the issue is gone.
Loves coding too much. Don't forget about code even when catching a cold indeed.