ruby-on-railsrubygemsbcryptbcrypt-ruby

Can't figure out how to get 'bcrypt' working in ruby on rails (WIN 10)


I've almost given up , after trying countless solutions , nothing has worked for me till now. I'm running Ruby 2.3.3 and rails 4.2.8 on windows 10 64-bit I've installed Ruby , Rails and DevKit using Rails Installer. I installed bcrypt v 3.1.7 ( to avoid compatibility issues )

gem list bcrypt

* LOCAL GEMS *

bcrypt (3.1.7 x86-mingw32)

I run rake db:migrate ( I have a few seeds ) and get this -

enter image description here

I've tried a lot of solutions. The most popular being uninstalling bcrypt and installing bcrypt in this manner - "gem install bcrypt --platform=ruby" But when I try to do that, I get this error -

enter image description here

I've also tried navigating to the folder where the gem is installed and running -

ruby extconf.rb

But that gives me a bunch of errors basically saying " You need to install Development Tools first" But Devkit has been installed by RailsInstaller. Even after I navigate to Devkit folder and run following commands I get an error -

enter image description here

So I add my Ruby root directory to config.yml - C:\RailsInstaller\Ruby2.3.3 and get following error -

enter image description here

This leads me to believe that DevKit tools have been installed but I still get an error saying that they need to be installed when I run ruby extconf.rb

I just want to get bcrypt running on my machine , any ideas what can I do ?


Solution

  • Try fixing your gemfile. You're working in a 64 bit operating system, but you've specified a 32 bit version of bcrypt in your gemfile:

    bcrypt (3.1.7 x86-mingw32)
    

    This notation leads to a cascade of problems because bcrypt wants to install 32 bit dependencies (psych) as well.

    Specify the 64 bit version of bcrypt in your gemfile and see what happens:

    bcrypt (3.1.7-x64-mingw32)
    

    Then run:

    bundle install
    

    You should be in good shape from there on out. I'm not sure, since I'm too lazy to boot into Windows at the moment, but I think you can probably get away with not specifying a version of bcrypt at all, and letting bundler figure it out by itself based on your platform.