Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught exception: cannot load such file -- bcrypt #85

Closed
roberts1000 opened this issue Dec 12, 2013 · 5 comments
Closed

Uncaught exception: cannot load such file -- bcrypt #85

roberts1000 opened this issue Dec 12, 2013 · 5 comments

Comments

@roberts1000
Copy link

I'm not able to run bcrypt-ruby on a Windows 64bit machine (with 64bit Ruby 2.0.0) via the Gemfile. This issue has occurred for a while, at least since Rails 3.2.12+. It is continuing to happen Rails 4.0.2. I have tried adding the following to my Gemfile:

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

and

 gem 'bcrypt-ruby', '~> 3.1.2', :require => 'bcrypt'

When I run bundle install It doesn't appear that bcrypt-ruby is being used. There is no output saying 'Using bcrypt-ruby ...` from bundler.

I've tried installing the gem from the command line via:

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

and

 gem install bcrypt-ruby

The gem will compile in both cases, however, when I delete Gemfile.lock and run bundle install again, bundler will still not pick up on the gem. If I try and start the rails server in this state, I receive the following error:

 Uncaught exception: cannot load such file -- bcrypt

The only solution that seems to work to add the following to the Gemfile

 gem 'bcrypt-ruby', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
@tmm1
Copy link
Collaborator

tmm1 commented Dec 12, 2013

gem install bcrypt-ruby --platform=ruby

This probably installed the gem without the extension.. try gem uninstall bcrypt-ruby first?

@roberts1000
Copy link
Author

I've given that a shot, it doesn't appear to help.

@tjschuck
Copy link
Collaborator

@roberts1000 Can you confirm whether or not this is still an issue? Does the following in your Gemfile work?

gem 'bcrypt', '~> 3.1.7'

For the sake of issue management, I'm going to close this until more info is provided. I'll reopen once you respond.

@roberts1000
Copy link
Author

@tjschuck 3.1.2 actually started working for me. If you guys didn't work some magic, I believe it had something to do with bundler. I was using an older version of bundler that could not manage gems on 64bit windows (see rubygems/bundler#2658 for more info). I upgraded bundler to fix an issue in another gem and when I tried bcrypt again a couple weeks later it was working as well. I can confirm that 3.1.7 too.

@tjschuck
Copy link
Collaborator

Awesome, thanks @roberts1000. 64bit Win support was added in 3.1.2 initially, so I'm glad to hear it was in fact working.

Thanks for posting the upgrade-bundler solution -- hopefully that will help anyone else that finds the issue in the future ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants