Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bcrypt error: Devise ruby 2.0 and rails 4.0

I keep getting this error when i try to run my app:

C:/ruby-2.0.0-p195-i386-mingw32/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0.rc1 /lib/active_support/dependencies.rb:228:in `require': cannot load such file -- 2 .0/bcrypt_ext (LoadError)

Any takers? - im trying to use the devise gem for basic user authentication..

like image 264
Mulaiko Avatar asked Jun 05 '13 16:06

Mulaiko


2 Answers

I've gotten this error when I updated to Ruby 2.0.0+ on Windows. I was able to solve it by uninstalling all versions of bcrypt that were downloaded, and building the gem using DevKit.

gem uninstall bcrypt-ruby

gem install bcrypt-ruby --platform=ruby --no-ri --no-rdoc

Usually doing a bundle update will download a precompiled gem mingw32 extension, which in this case appears not to work. This workaround for reinstalling bcrypt-ruby will hopefully not be needed in the future.

Additionally, I keep updated Windows installation instructions for Ruby on Rails here (mostly for my own reference) for installing Ruby on Rails on Windows.

https://github.com/remomueller/documentation/tree/master/windows

Some other Windows pitfalls you may run into are also listed there:

https://github.com/remomueller/documentation/blob/master/windows/190-miscellaneous.md

like image 95
remo Avatar answered Oct 10 '22 07:10

remo


Until this problem is fixed, the best workaround is to install bcrypt-ruby from git:

gem 'bcrypt-ruby', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'

Update (June 2016.) - as @gneri mentioned, bcrypt-ruby changed it's name to bcrypt, so use:

gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
like image 26
mihai Avatar answered Oct 10 '22 05:10

mihai