Nilesh
Nilesh

Reputation: 21

bcrypt-ruby - You don't have bcrypt-ruby installed in your application

I'm beginner in Ruby on Rails and trying to learn from http://ruby.railstutorial.org/ I'm creating sample_app and got stuck at chapter 6.

My Ruby version: ruby 2.0.0p195 (2013-05-14) [i386-mingw32]

My Rails version: Rails 4.0.0

I have following line in my GemFile:

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

If I type gem list bcrypt-ruby , it shows bcrypt-ruby (3.0.1) . But if I try to create user, I get error saying

You don't have bcrypt-ruby installed in your application. Please add it to your Gemfile and run bundle install

I searched a lot on rails website, bcrypt website & even stackoverflow. But, nothing worked. Please help.

Upvotes: 2

Views: 6492

Answers (6)

jjhiggz
jjhiggz

Reputation: 69

In my case, the problem was that bcrypt version 3.1.2 was outdated. Fortunately Ruby has a way of installing the most up to date version of a particular gem right from your command line. In this case I typed in

bundle pristine bcrypt

but more generally you can do

bundle pristine gem name

If you think you might be running into a similar issue with a different gem

Upvotes: 0

Nilesh
Nilesh

Reputation: 21

Finally... Got it working. I didn't understand the exact issue but I made two important changes. I'm not sure which change made it working.

  1. I uninstalled my old ruby & rails that were installed from railsinstaller. Installed just ruby for my OS (64 bit which I was not able to choose while installing from railsinstaller). Then I installed rails, sqlite3 separately.

  2. Another important change I did is in Gemfile.lock. I think this did the trick. I kept both of the following lines

    bcrypt-ruby (3.0.0) bcrypt-ruby (3.0.0-x86-mingw32)

Upvotes: 0

him
him

Reputation: 3575

add below in gem file

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

and run bundle install and restart server

Upvotes: 0

weezilla
weezilla

Reputation: 168

I've faced this issue recently (as have many others). As per ladyruby723 posted here, use gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' in your gemfile file.

Upvotes: 4

Jacky
Jacky

Reputation: 11

I solved this the same problem by the following line:

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

Upvotes: 1

KnownColor
KnownColor

Reputation: 449

I believe this exact issue is solved in another question. There are actually two error messages produced, this being the higher level one, by searching for the lower level I found the below answer.

can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.1. Make sure all dependencies are added to Gemfile

Upvotes: 0

Related Questions