Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on windows causes error Cannot load such file bcrypt_ext

Trying to run ruby on my Windows 7 machine whenever i go to rails s or rake db:migrate i get the following error Cannot load such file bcrypt_ext.

My ruby version is 2.2.1 my rails version is 4.2.0 and the bcrypt version is 3.1.10. All the gems install correctly when i run bundle install however whenever i try to rake it gives me that error. Any help would be greatly appreciated

like image 592
Byrd Avatar asked Mar 27 '15 04:03

Byrd


3 Answers

You need to use what it says here: https://www.alib.jp/entries/bcrypt_ext_load_error_on_ruby21x

C:\> gem install --no-ri --no-rdoc bcrypt
C:\> cd (path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> ruby extconf.rb
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> make
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> make install
like image 167
Richard Peck Avatar answered Nov 15 '22 08:11

Richard Peck


I meet the same problem in Window 8.1 64bit , Ruby 2.3.3 64bit , Rails 4.2.10.

My quick solution :

Step 1 : Remove all bcrypt in gem : gem uninstall bcrypt ( choose option 3 if existed (remove all))

Step 2 : Install bcrypt again : gem install bcrypt

Then check version of bcrypt : gem list bcrypt

Step 3 : In Gemfile of your project, add : gem 'bcrypt', '3.1.11', platforms: [:ruby, :x64_mingw] notice : change the suitable version of your bcrypt (my version : 3.1.11)

Step 4 : Run command in the path of your project : bundle install

Step 5 : Remove the unneeded bcrypt : Run command : gem uninstall bcrypt You can see some version of bcrypt , you should keep one version : bcrypt-[your-version] . (Remove all version : bcrypt-[your-version]-x64-mingw32 . In mycase , remove : bcrypt-3.1.11-x64-mingw32)

Restart Rails sever , done

I think this proplem because when we install bcrypt , we didn't specify 64bit or 32bit , it is not compatible with window or ruby ( 64bit or 32bit )

like image 33
Phi Ưng Avatar answered Nov 15 '22 07:11

Phi Ưng


For Windows 10, bcrypt 3.1.11 now works, checked in 24144

steps:

  1. shut down all rails servers
  2. uninstall all versions of bcrypt
  3. manually install v3.1.1 (gem install bcrypt -v '3.1.11')
  4. update gem files of projects

current versions

  • ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]

  • OS Name: Microsoft Windows 10 Pro

  • OS Version: 10.0.10586 N/A Build 10586

like image 36
Mark Filley Avatar answered Nov 15 '22 06:11

Mark Filley