3

Has anyone had any issues installing bcrypt 3.0.1 or 3.1.2 on Windows 8? I've tried testing different versions but i'm getting this error.

but I'm getting this error after running rails server. cannot load such file -- 2.0/bcrypt_ext "You don't have bcrypt-ruby installed in your application. please add it to your gemfile and run bundle install"

I'm using: OS: Windows 8 Rails 4.0.0 Ruby 2.0.0 bcrypt-ruby 3.0.1

my gemsfile has bcrypt defined as this. gem 'bcrypt-ruby', '3.0.1'

When I uninstalled 3.0.1 and installed 3.1.2, update my gemfile to point to 3.1.2, run bundle install, then run rails server i'm getting an error:

"can't activate bcrypt-ruby (~>3.0.0), already activated 3.1.2...make sure all dependencies are added to gemfile."

I tried doing a bundle update to make I get all the dependencies but no luck. I've searched multiple forums and tried many solutions to no luck. I'd love any advice and feedback you may have.

Thank you!

NewFndGlry
  • 31
  • 3

2 Answers2

9

bcrypt-ruby 3.0.1 was released about 2 years ago and is not compatible with your environment. You have to use the latest release [3.1.2].

That's how I declared it in my Gemfile:

gem 'bcrypt-ruby', github: 'codahale/bcrypt-ruby'

or

gem 'bcrypt-ruby', '3.1.2'

to get it from http://rubygems.org

To get rid of error (can't activate bcrypt-ruby (~> 3.0.0), ...) go to

ruby_dir/lib/ruby/gems/2.0.0/gems/activemodel-4.0.0/lib/active_model/secure_password.rb:47

and change the line to

gem 'bcrypt-ruby', '~> 3.0.0'

to

gem 'bcrypt-ruby', '~> 3.1.0'
beta-closed
  • 295
  • 1
  • 3
  • 10
  • installing is the easy part. the kicker, and what makes this truly correct is changing active model to look for `~> 3.1.0`. thanks! – Dudo Oct 30 '13 at 04:44
  • great thing. In other environments, search for secure_password.rb in your ruby folder and change the line in all of them. On Ubuntu I have 2 of these and one has version '~> 3.1.0', but the other '~> 3.0.0' – ex-man Jan 07 '14 at 22:00
  • I needed to run `bundle update` in order to have the changes take effect. – Godwin Feb 17 '14 at 19:30
  • I ran into issues because bcrypt wasn't getting loaded as well. Also worthwhile to delete gemfile.lock, and play around by loading up both bcrypt-ruby and bcrypt gems within irb. This definitely pointed me in the right direction, thanks! – Max Alcala Dec 04 '14 at 22:38
1

I ran into the same issues when building the sample app at http://ruby.railstutorial.org/. This this answer, with a little tweaking, solved it for me:

https://stackoverflow.com/a/17368137/2721455

After uninstalling and re-installing the gem according to the direction in the post above, I went into my Ruby200/lib/ruby/gems/2.0.0/gems directory and deleted all of the versions of bcrypt-ruby that ended in -mingw32 or -mingw64, leaving 'bcrypt-ruby-3.0.1' and 'bcrypt-ruby-3.1.2' in tact.

Be warned -- if you run a bundle update, you'll have to do this all over again because the Windows version of bcrypt-ruby will be automatically re-installed.

Community
  • 1
  • 1
skmichaelson
  • 450
  • 5
  • 7
  • I hit this also in the tutorial. Did you also need to change the gem requirement for active record as in the previous answer? – nPn Jan 03 '14 at 21:54
  • I am facing the same issue... Did you deploy on heorku? It does not seem to work, so I am not sure whether you had a chance to make it work... I am now in an email exchange with them, but no help. – ex-man Jan 07 '14 at 22:03
  • @ex-man I assume you got past this already, but since I am doing the upgrading my version of the sample app to 4.0.3 I thought I might run into this issue again so I stumbled on your comment. Here is how I managed to get past this problem http://stackoverflow.com/questions/20914872/how-do-i-specify-different-versions-of-a-gem-for-development-and-production – nPn Mar 16 '14 at 17:41
  • @nPn Great! this seems to be much better then my manual workaround of distributing to heroku form linux and developing under windows... Cheers. – ex-man Mar 17 '14 at 14:16