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

BCrypt 3.1.11 (x86-mingw32): cannot load such file -- bcrypt_ext #149

Closed
TheFlow0360 opened this Issue Feb 27, 2017 · 41 comments

Comments

Projects
None yet
@TheFlow0360

TheFlow0360 commented Feb 27, 2017

I recently created a new Rails project after installing Ruby and Rails on Windows with RailsInstaller. In my gemfile, I reference bcrypt like this:
gem 'bcrypt', '~> 3.1.7', platforms: :ruby (I added the platforms: :ruby, without server won't start with the same error as described further below)

The server can be started, no problems here, but wen instantiating a model with has_secure_password I get the following error message:

You don't have bcrypt installed in your application. Please add it to your Gemfile and run bundle install
Completed 500 Internal Server Error in 16ms (ActiveRecord: 0.0ms)

LoadError (cannot load such file -- bcrypt_ext):

app/models/access.rb:2:in <class:Access>' app/models/access.rb:1:in<top (required)>'
Rendering C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.0ms)
Rendering C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.0ms)
Rendering C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)
Rendered C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (358.0ms)
Exiting

I tried fixing the version of bcrypt to 3.1.9, because I found this issue where a similar error occurred for the 3.1.7 and the solution was to use 3.1.9, but this didn't help at all, on the contrary: Afterwards the server wouldn't start at all.

I know there is Issue 142, but their solution doesn't work for me.

Does anyone have an idea how I could fix this?

@TheFlow0360 TheFlow0360 changed the title from BCrypt 3.1.11 (x68-mingw32): cannot load such file -- bcrypt_ext to BCrypt 3.1.11 (x86-mingw32): cannot load such file -- bcrypt_ext Feb 27, 2017

@fpauser

This comment has been minimized.

Show comment
Hide comment
@fpauser

fpauser Mar 2, 2017

Same problem here...

fpauser commented Mar 2, 2017

Same problem here...

@gvescu

This comment has been minimized.

Show comment
Hide comment
@gvescu

gvescu Mar 4, 2017

Just got this issue again. The only solution right now is to run:

gem uninstall bcrypt
gem install bcrypt --platform=ruby

I suppose it's just a temporary fix.

gvescu commented Mar 4, 2017

Just got this issue again. The only solution right now is to run:

gem uninstall bcrypt
gem install bcrypt --platform=ruby

I suppose it's just a temporary fix.

@TheFlow0360

This comment has been minimized.

Show comment
Hide comment
@TheFlow0360

TheFlow0360 Mar 6, 2017

I already tried that, this doesn't fix the problem for me. I did this to be able to start the server at all, but when using my model with has_secure_password the exception still occurs.

TheFlow0360 commented Mar 6, 2017

I already tried that, this doesn't fix the problem for me. I did this to be able to start the server at all, but when using my model with has_secure_password the exception still occurs.

@scivola

This comment has been minimized.

Show comment
Hide comment
@scivola

scivola Mar 6, 2017

How about this?

gem list bcrypt

scivola commented Mar 6, 2017

How about this?

gem list bcrypt
@TheFlow0360

This comment has been minimized.

Show comment
Hide comment
@TheFlow0360

TheFlow0360 Mar 6, 2017

what about it? It outputs the gems:

gem list bcrypt

*** LOCAL GEMS ***

bcrypt (3.1.11)

TheFlow0360 commented Mar 6, 2017

what about it? It outputs the gems:

gem list bcrypt

*** LOCAL GEMS ***

bcrypt (3.1.11)

@scivola

This comment has been minimized.

Show comment
Hide comment
@scivola

scivola Mar 6, 2017

Hmm...

Are there bcrypt_ext.* in the subdirectories of C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11/ext ?

scivola commented Mar 6, 2017

Hmm...

Are there bcrypt_ext.* in the subdirectories of C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11/ext ?

@TheFlow0360

This comment has been minimized.

Show comment
Hide comment
@TheFlow0360

TheFlow0360 Mar 6, 2017

Subfolder jruby just contains another folder bcrypt_jruby with a BCrypt.java, other folder is mri with the following content:

Verzeichnis von C:\RailsInstaller\Ruby2.3.0\lib\ruby\gems\2.3.0\gems\bcrypt-3.1.11\ext\mri

06.03.2017 09:50 <DIR> .
06.03.2017 09:50 <DIR> ..
06.03.2017 09:50 0 .RUBYARCHDIR.time
06.03.2017 09:50 24 bcrypt_ext-i386-mingw32.def
06.03.2017 09:49 1.540 bcrypt_ext.c
06.03.2017 09:50 8.837 bcrypt_ext.o
06.03.2017 09:50 33.280 bcrypt_ext.so
06.03.2017 09:49 1.062 crypt.c
06.03.2017 09:49 268 crypt.h
06.03.2017 09:50 8.668 crypt.o
06.03.2017 09:49 26.325 crypt_blowfish.c
06.03.2017 09:50 74.787 crypt_blowfish.o
06.03.2017 09:49 3.348 crypt_gensalt.c
06.03.2017 09:50 4.785 crypt_gensalt.o
06.03.2017 09:49 417 extconf.rb
06.03.2017 09:49 7.941 Makefile
06.03.2017 09:49 998 ow-crypt.h
06.03.2017 09:49 7.098 wrapper.c
06.03.2017 09:50 8.065 wrapper.o
17 Datei(en), 187.443 Bytes
2 Verzeichnis(se), 753.023.946.752 Bytes frei

Sorry for the bad formatting, the tabs are getting truncated.

TheFlow0360 commented Mar 6, 2017

Subfolder jruby just contains another folder bcrypt_jruby with a BCrypt.java, other folder is mri with the following content:

Verzeichnis von C:\RailsInstaller\Ruby2.3.0\lib\ruby\gems\2.3.0\gems\bcrypt-3.1.11\ext\mri

06.03.2017 09:50 <DIR> .
06.03.2017 09:50 <DIR> ..
06.03.2017 09:50 0 .RUBYARCHDIR.time
06.03.2017 09:50 24 bcrypt_ext-i386-mingw32.def
06.03.2017 09:49 1.540 bcrypt_ext.c
06.03.2017 09:50 8.837 bcrypt_ext.o
06.03.2017 09:50 33.280 bcrypt_ext.so
06.03.2017 09:49 1.062 crypt.c
06.03.2017 09:49 268 crypt.h
06.03.2017 09:50 8.668 crypt.o
06.03.2017 09:49 26.325 crypt_blowfish.c
06.03.2017 09:50 74.787 crypt_blowfish.o
06.03.2017 09:49 3.348 crypt_gensalt.c
06.03.2017 09:50 4.785 crypt_gensalt.o
06.03.2017 09:49 417 extconf.rb
06.03.2017 09:49 7.941 Makefile
06.03.2017 09:49 998 ow-crypt.h
06.03.2017 09:49 7.098 wrapper.c
06.03.2017 09:50 8.065 wrapper.o
17 Datei(en), 187.443 Bytes
2 Verzeichnis(se), 753.023.946.752 Bytes frei

Sorry for the bad formatting, the tabs are getting truncated.

@TheFlow0360

This comment has been minimized.

Show comment
Hide comment
@TheFlow0360

TheFlow0360 Mar 7, 2017

I just noticed, when really uninstalling and reinstalling bcrypt it works, the problem is that after running bundler install the wrong bcrypt get's installed. I just don't understand why.

Installing with gem install bcrypt --platform=ruby is working, and my gemfile contains gem 'bcrypt', '~> 3.1.7', platforms: :ruby but breaks the installation. What do I need to write there to be equivalent?

TheFlow0360 commented Mar 7, 2017

I just noticed, when really uninstalling and reinstalling bcrypt it works, the problem is that after running bundler install the wrong bcrypt get's installed. I just don't understand why.

Installing with gem install bcrypt --platform=ruby is working, and my gemfile contains gem 'bcrypt', '~> 3.1.7', platforms: :ruby but breaks the installation. What do I need to write there to be equivalent?

@Goku-San

This comment has been minimized.

Show comment
Hide comment
@Goku-San

Goku-San Mar 15, 2017

hello, just had the same problem, and solved it, with uninstall - install solution provided from issue 142 The way it worked for me is in the gem file I commented out # gem bcrypt, '3.1.11' and run bundle install... after that UnCommented gem 'bcrypt', '3.1.11', platforms: [:ruby, :x64_mingw] and again bundle install and that's it. Hope this helps someone..

P.S :x64_mingw is for 64x Windows. I am on win7x64

Goku-San commented Mar 15, 2017

hello, just had the same problem, and solved it, with uninstall - install solution provided from issue 142 The way it worked for me is in the gem file I commented out # gem bcrypt, '3.1.11' and run bundle install... after that UnCommented gem 'bcrypt', '3.1.11', platforms: [:ruby, :x64_mingw] and again bundle install and that's it. Hope this helps someone..

P.S :x64_mingw is for 64x Windows. I am on win7x64

@gaumondia

This comment has been minimized.

Show comment
Hide comment
@gaumondia

gaumondia Mar 19, 2017

@hellrider200 somehow that didn't work on my end and the solution listed here worked instead #102
Hopefully it helps someone else too!

gaumondia commented Mar 19, 2017

@hellrider200 somehow that didn't work on my end and the solution listed here worked instead #102
Hopefully it helps someone else too!

@TheFlow0360

This comment has been minimized.

Show comment
Hide comment
@TheFlow0360

TheFlow0360 Mar 20, 2017

@gaumondia yeah but referencing the github version isn't exactly something I want to do when the project goes into production...

TheFlow0360 commented Mar 20, 2017

@gaumondia yeah but referencing the github version isn't exactly something I want to do when the project goes into production...

@overload77

This comment has been minimized.

Show comment
Hide comment
@overload77

overload77 Mar 23, 2017

I solved it based on hellriders solution.First of all comment out # gem bcrypt, '3.1.11' and run bundle install.After that uninstall the gem with gem uninstall bcrypt.Then re-install gem install bcrypt --platform=ruby.The important part, un-comment gem 'bcrypt', '~> 3.1.11', platforms: [:ruby, :x64_mingw, :mingw] and then bundle install.Thats it.Note the mingw part at the end.This should be the key.

P.S i think bcrypt is running on 32bit environment regardless of your operating system.
P.S 2 Yeah bundle install breaking bcrypt somehow.Temporary solution is commenting out gem 'bcrypt' everytime before bundle install and then un-comment.I hope it will be fixed soon, it is so dumb.

overload77 commented Mar 23, 2017

I solved it based on hellriders solution.First of all comment out # gem bcrypt, '3.1.11' and run bundle install.After that uninstall the gem with gem uninstall bcrypt.Then re-install gem install bcrypt --platform=ruby.The important part, un-comment gem 'bcrypt', '~> 3.1.11', platforms: [:ruby, :x64_mingw, :mingw] and then bundle install.Thats it.Note the mingw part at the end.This should be the key.

P.S i think bcrypt is running on 32bit environment regardless of your operating system.
P.S 2 Yeah bundle install breaking bcrypt somehow.Temporary solution is commenting out gem 'bcrypt' everytime before bundle install and then un-comment.I hope it will be fixed soon, it is so dumb.

@TheFlow0360

This comment has been minimized.

Show comment
Hide comment
@TheFlow0360

TheFlow0360 Mar 23, 2017

@overload77 it seems as if this solves my problem with bundler reinstalling the wrong gem, even though I don't really understand why... thanks, anyways!

TheFlow0360 commented Mar 23, 2017

@overload77 it seems as if this solves my problem with bundler reinstalling the wrong gem, even though I don't really understand why... thanks, anyways!

@Goku-San

This comment has been minimized.

Show comment
Hide comment
@Goku-San

Goku-San Mar 23, 2017

@TheFlow0360 glad you solved it as well, one thing though, now when you want to install new gem for the given project, install it with the gem install command, because if you do it with bundle install it will see the extensions/options for bcrypt ie. platforms: [:ruby, :x64_mingw, :mingw] and will install the gem for those platforms meaning for :x64_mingw, :mingw and it will error again
So when using gem install, bundler will not install just use the new gem and it will not see the bcrypt extensions/options... try that and tell if it worked...

Goku-San commented Mar 23, 2017

@TheFlow0360 glad you solved it as well, one thing though, now when you want to install new gem for the given project, install it with the gem install command, because if you do it with bundle install it will see the extensions/options for bcrypt ie. platforms: [:ruby, :x64_mingw, :mingw] and will install the gem for those platforms meaning for :x64_mingw, :mingw and it will error again
So when using gem install, bundler will not install just use the new gem and it will not see the bcrypt extensions/options... try that and tell if it worked...

@TheFlow0360

This comment has been minimized.

Show comment
Hide comment
@TheFlow0360

TheFlow0360 Mar 23, 2017

Yeah, I did install bcrypt manually, so this may be true. But before every time I executed bundle install it still installed the wrong bcrypt on top, now it doesn't do this anymore. And you think if it's the first install this still won't work? I don't want to set up another environment just to test this right now, but if you are right this is still quite bad... The aim should be that bundler fully prepares my environment...

TheFlow0360 commented Mar 23, 2017

Yeah, I did install bcrypt manually, so this may be true. But before every time I executed bundle install it still installed the wrong bcrypt on top, now it doesn't do this anymore. And you think if it's the first install this still won't work? I don't want to set up another environment just to test this right now, but if you are right this is still quite bad... The aim should be that bundler fully prepares my environment...

@michael-wise

This comment has been minimized.

Show comment
Hide comment
@michael-wise

michael-wise Mar 29, 2017

Yeah this is really frustrating. There are already several issues windows users face when trying to do rails development :(. I'm practicing rails development again after taking a break and remember facing this months ago. This time in opting for a simpler login system using bcrypt, the issue reappears. I tried @overload77's solution but still face the error:

C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in require': cannot load such file -- bcrypt_ext (L oadError) from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:inrescue in <top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:12:in <top (required)>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:91:inrequire'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:91:in block (2 levels) in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:86:ineach'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:86:in block in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:75:ineach'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:75:in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler.rb:107:inrequire'
from C:/sites/mleewise/config/application.rb:7:in <top (required)>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:88:inrequire'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:88:in block in server' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:intap'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in server' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:inrun_command!'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in <top (required)>' from bin/rails:4:inrequire'
from bin/rails:4:in `

'

I would be willing to put $20 towards a bounty for a proper fix...if anyone else wants to chip in.

michael-wise commented Mar 29, 2017

Yeah this is really frustrating. There are already several issues windows users face when trying to do rails development :(. I'm practicing rails development again after taking a break and remember facing this months ago. This time in opting for a simpler login system using bcrypt, the issue reappears. I tried @overload77's solution but still face the error:

C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in require': cannot load such file -- bcrypt_ext (L oadError) from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:inrescue in <top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:12:in <top (required)>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:91:inrequire'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:91:in block (2 levels) in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:86:ineach'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:86:in block in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:75:ineach'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler/runtime.rb:75:in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.4/lib/bundler.rb:107:inrequire'
from C:/sites/mleewise/config/application.rb:7:in <top (required)>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:88:inrequire'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:88:in block in server' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:intap'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in server' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:inrun_command!'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in <top (required)>' from bin/rails:4:inrequire'
from bin/rails:4:in `

'

I would be willing to put $20 towards a bounty for a proper fix...if anyone else wants to chip in.

@TheFlow0360

This comment has been minimized.

Show comment
Hide comment
@TheFlow0360

TheFlow0360 Mar 29, 2017

@michael-wise did you try everything listed in this thread? I got it running, even though the solution isn't perfect because bundler won't install it correctly in a new environment. The key for me is that only the normal bcrypt gem may be installed, as soon as the mingw x86 is there it won't work anymore.

TheFlow0360 commented Mar 29, 2017

@michael-wise did you try everything listed in this thread? I got it running, even though the solution isn't perfect because bundler won't install it correctly in a new environment. The key for me is that only the normal bcrypt gem may be installed, as soon as the mingw x86 is there it won't work anymore.

@michael-wise

This comment has been minimized.

Show comment
Hide comment
@michael-wise

michael-wise Mar 29, 2017

*Update1--I'm getting the LoadError (cannot load such file -- bcrypt): problem.
**Update2 (solution)--The solution here seems to be working and also a quick fix!
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' allows a simple bundle install.

Original:
@TheFlow0360. Success*--I repeated @overload77's process but replaced the Gemfile's platforms: [:ruby, :x64_mingw, :mingw] with platforms [:ruby].

I did this because I noticed that gem install bcrypt --platform=ruby and gem list bcrypt shows bcrypt (3.1.11) while gem list bcrypt after his instructions showed the damning bcrypt 3.1.11 (x64-mingw32).

Also, as I see, the first bundle install in his instructions is redundant, as doing gem uninstall bcrypt removes the gem.

michael-wise commented Mar 29, 2017

*Update1--I'm getting the LoadError (cannot load such file -- bcrypt): problem.
**Update2 (solution)--The solution here seems to be working and also a quick fix!
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' allows a simple bundle install.

Original:
@TheFlow0360. Success*--I repeated @overload77's process but replaced the Gemfile's platforms: [:ruby, :x64_mingw, :mingw] with platforms [:ruby].

I did this because I noticed that gem install bcrypt --platform=ruby and gem list bcrypt shows bcrypt (3.1.11) while gem list bcrypt after his instructions showed the damning bcrypt 3.1.11 (x64-mingw32).

Also, as I see, the first bundle install in his instructions is redundant, as doing gem uninstall bcrypt removes the gem.

@kalyn-robinson

This comment has been minimized.

Show comment
Hide comment
@kalyn-robinson

kalyn-robinson Mar 29, 2017

@ladyruby723's solution in an earlier issue solved this for me:

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

kalyn-robinson commented Mar 29, 2017

@ladyruby723's solution in an earlier issue solved this for me:

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

@TheFlow0360

This comment has been minimized.

Show comment
Hide comment
@TheFlow0360

TheFlow0360 Mar 30, 2017

@kalyn-robinson this does work for most of us, but it isn't something you really want to have for a project that goes into production. Reinstall somewhere else later, und you get a different version of bcrypt? This could be bad. For bcrypt this problem may be less relevant, but in general I don't want to reference the master branch of a gem except for development or testing purposes.

TheFlow0360 commented Mar 30, 2017

@kalyn-robinson this does work for most of us, but it isn't something you really want to have for a project that goes into production. Reinstall somewhere else later, und you get a different version of bcrypt? This could be bad. For bcrypt this problem may be less relevant, but in general I don't want to reference the master branch of a gem except for development or testing purposes.

@Klashe

This comment has been minimized.

Show comment
Hide comment
@Klashe

Klashe May 20, 2017

I solve it with uninstall all bcrypt gem versions with gem uninstall bcrypt and select option 3 (if exist)
and uninstall all bcrypt-ruby gem versions with gem uninstall bcrypt-ruby and select option 3 (if exist).

Then added this to my gemfile gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' then bunddle install.

Klashe commented May 20, 2017

I solve it with uninstall all bcrypt gem versions with gem uninstall bcrypt and select option 3 (if exist)
and uninstall all bcrypt-ruby gem versions with gem uninstall bcrypt-ruby and select option 3 (if exist).

Then added this to my gemfile gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' then bunddle install.

@Dromin Dromin referenced this issue Jun 9, 2017

Closed

Cross-platform compatibility #94

0 of 1 task complete
@Mifrill

This comment has been minimized.

Show comment
Hide comment
@Mifrill

Mifrill Jul 16, 2017

Mifrill commented Jul 16, 2017

@amicloud

This comment has been minimized.

Show comment
Hide comment
@amicloud

amicloud Jul 17, 2017

I was having this issue and managed to fix it by uninstalling bcrypt with gem uninstall bcrypt and removing it from my Gemfile. I believe the problem was being caused by another conflicting gem that uses bcrypt.

amicloud commented Jul 17, 2017

I was having this issue and managed to fix it by uninstalling bcrypt with gem uninstall bcrypt and removing it from my Gemfile. I believe the problem was being caused by another conflicting gem that uses bcrypt.

@daffe1er

This comment has been minimized.

Show comment
Hide comment
@daffe1er

daffe1er Sep 21, 2017

I have the same problem like TheFlow0360. i have done all that is done but the problem is reoccuring, can you help please

C:\Users\DAFFE.DAFFE>rake dev_data:create
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)

(See full trace by running task with --trace)

C:\Users\DAFFE.DAFFE>cd challenger

C:\Users\DAFFE.DAFFE\challenger>rake dev_data:create
rake aborted!
LoadError: cannot load such file -- bcrypt
C:/Users/DAFFE.DAFFE/challenger/app/models/user.rb:1:in <top (required)>' C:/Users/DAFFE.DAFFE/challenger/lib/tasks/dev_data.rake:9:inblock (2 levels) in <top (required)>'
Tasks: TOP => dev_data:create
(See full trace by running task with --trace)

C:\Users\DAFFE.DAFFE\challenger>bundle list bcrypt
Could not find gem 'bcrypt'.

C:\Users\DAFFE.DAFFE\challenger>gem list bcrypt

*** LOCAL GEMS ***

bcrypt (3.1.11 x64-mingw32)

daffe1er commented Sep 21, 2017

I have the same problem like TheFlow0360. i have done all that is done but the problem is reoccuring, can you help please

C:\Users\DAFFE.DAFFE>rake dev_data:create
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)

(See full trace by running task with --trace)

C:\Users\DAFFE.DAFFE>cd challenger

C:\Users\DAFFE.DAFFE\challenger>rake dev_data:create
rake aborted!
LoadError: cannot load such file -- bcrypt
C:/Users/DAFFE.DAFFE/challenger/app/models/user.rb:1:in <top (required)>' C:/Users/DAFFE.DAFFE/challenger/lib/tasks/dev_data.rake:9:inblock (2 levels) in <top (required)>'
Tasks: TOP => dev_data:create
(See full trace by running task with --trace)

C:\Users\DAFFE.DAFFE\challenger>bundle list bcrypt
Could not find gem 'bcrypt'.

C:\Users\DAFFE.DAFFE\challenger>gem list bcrypt

*** LOCAL GEMS ***

bcrypt (3.1.11 x64-mingw32)

@zinderud

This comment has been minimized.

Show comment
Hide comment
@zinderud

zinderud Oct 10, 2017

I temporary fix.
gem uninstall bcrypt
gem install bcrypt --platform=ruby
but all new add gem conflicting and again..

zinderud commented Oct 10, 2017

I temporary fix.
gem uninstall bcrypt
gem install bcrypt --platform=ruby
but all new add gem conflicting and again..

@johnnyshields

This comment has been minimized.

Show comment
Hide comment
@johnnyshields

johnnyshields Dec 18, 2017

@tjschuck what's the plan to fix this? Issue has been out there for quite a long time now and is an annoyance for all Windows users

johnnyshields commented Dec 18, 2017

@tjschuck what's the plan to fix this? Issue has been out there for quite a long time now and is an annoyance for all Windows users

@gizellysteffanny

This comment has been minimized.

Show comment
Hide comment
@gizellysteffanny

gizellysteffanny Jan 25, 2018

gem list bcrypt
gem uninstall bcrypt
gem install bcrypt --platform=ruby

gizellysteffanny commented Jan 25, 2018

gem list bcrypt
gem uninstall bcrypt
gem install bcrypt --platform=ruby

@johnnyshields

This comment has been minimized.

Show comment
Hide comment
@johnnyshields

johnnyshields Jan 25, 2018

@gizellysteffanny that's the workaround. You need to run this after every bundle install/upgrade because Bcrypt mingw gets reinstalled.

johnnyshields commented Jan 25, 2018

@gizellysteffanny that's the workaround. You need to run this after every bundle install/upgrade because Bcrypt mingw gets reinstalled.

@Tommyleerom

This comment has been minimized.

Show comment
Hide comment
@Tommyleerom

Tommyleerom Mar 13, 2018

Is there any solution that for good and all fix the problem on windows?

Tommyleerom commented Mar 13, 2018

Is there any solution that for good and all fix the problem on windows?

@bodrovis

This comment has been minimized.

Show comment
Hide comment
@bodrovis

bodrovis Mar 15, 2018

AFAIK, the only solution to fix this problem once and for all is rebuild the gem locally (all other solutions seem to be temporary and were not very effective for me - for instance, everything started to break again after doing bundle updates). Perform the following steps:

  1. You need DevKit or MSYS (for newer Rubies) installed that can be taken from RubyInstaller site (MSYS is actually integrated into newer Ruby installers). Note that in case of DevKit the PATH should also contain c:\devkit\mingw\bin path (that has make.exe file)!
  2. Next, open up terminal and cd into the directory where BCrypt files reside. Something like c:\Ruby24\lib\ruby\gems\2.2.4\gems\bcrypt-3.1.11-x64-mingw32\ext\mri
  3. Here, run ruby extconf.rb
  4. Then make
  5. Then make install
  6. After this is done the problem should be fixed (also you might want to bundle install just in case). You don't need to add any platform: :ruby stuff to the Gemfile for bcrypt.

Note that steps 4 and 5 should be performed from MSYS command line interface if you are not using DevKit (that is, for newer Rubies)! In order to properly open this terminal run F:\msys64\msys2_shell.cmd -mingw64 (if you're using Windows x64). Hopefully this helps, and best of luck.

bodrovis commented Mar 15, 2018

AFAIK, the only solution to fix this problem once and for all is rebuild the gem locally (all other solutions seem to be temporary and were not very effective for me - for instance, everything started to break again after doing bundle updates). Perform the following steps:

  1. You need DevKit or MSYS (for newer Rubies) installed that can be taken from RubyInstaller site (MSYS is actually integrated into newer Ruby installers). Note that in case of DevKit the PATH should also contain c:\devkit\mingw\bin path (that has make.exe file)!
  2. Next, open up terminal and cd into the directory where BCrypt files reside. Something like c:\Ruby24\lib\ruby\gems\2.2.4\gems\bcrypt-3.1.11-x64-mingw32\ext\mri
  3. Here, run ruby extconf.rb
  4. Then make
  5. Then make install
  6. After this is done the problem should be fixed (also you might want to bundle install just in case). You don't need to add any platform: :ruby stuff to the Gemfile for bcrypt.

Note that steps 4 and 5 should be performed from MSYS command line interface if you are not using DevKit (that is, for newer Rubies)! In order to properly open this terminal run F:\msys64\msys2_shell.cmd -mingw64 (if you're using Windows x64). Hopefully this helps, and best of luck.

@vatanbytyqi

This comment has been minimized.

Show comment
Hide comment
@vatanbytyqi

vatanbytyqi Mar 20, 2018

Hi,
I'm still having this issue on my windows. I run windows 10 and use the railsinstaller 3.4.0 (which includes ruby 2.3.3).
I get the error LoadError (cannot load such file -- bcrypt_ext): when I log in to my site and not when the server is started.

I use Devise gem which installs bcrypt-3.1.11-x86-mingw32 when I run gem install Devise, and I'm required to uninstall Devise before I can uninstall bcrypt due to dependency issue. Why does not the same solution work with my setup?

vatanbytyqi commented Mar 20, 2018

Hi,
I'm still having this issue on my windows. I run windows 10 and use the railsinstaller 3.4.0 (which includes ruby 2.3.3).
I get the error LoadError (cannot load such file -- bcrypt_ext): when I log in to my site and not when the server is started.

I use Devise gem which installs bcrypt-3.1.11-x86-mingw32 when I run gem install Devise, and I'm required to uninstall Devise before I can uninstall bcrypt due to dependency issue. Why does not the same solution work with my setup?

@Tommyleerom

This comment has been minimized.

Show comment
Hide comment
@Tommyleerom

Tommyleerom Mar 22, 2018

@bodrovis thanks man :) your solution works for me (windows 7- x64)

Tommyleerom commented Mar 22, 2018

@bodrovis thanks man :) your solution works for me (windows 7- x64)

@ohiodn8

This comment has been minimized.

Show comment
Hide comment
@ohiodn8

ohiodn8 Mar 27, 2018

(No issue on Linux but every time I moved to Windows, I'll get the error). gem uninstall bcrypt and gem install bcrypt --platform=ruby was a temporary fix, broke after bundle install.

My Fix =>

gemfile.lock:
(Delete bcrypt from gemfile.lock)
Change devise to:
devise (4.4.3)
bcrypt (~> 3.0)

< scroll down to DEPENDENCIES >
DEPENDENCIES
bcrypt!
devise (~> 4.3)

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

To commandline:
gem uninstall bcrypt
bundle install

ohiodn8 commented Mar 27, 2018

(No issue on Linux but every time I moved to Windows, I'll get the error). gem uninstall bcrypt and gem install bcrypt --platform=ruby was a temporary fix, broke after bundle install.

My Fix =>

gemfile.lock:
(Delete bcrypt from gemfile.lock)
Change devise to:
devise (4.4.3)
bcrypt (~> 3.0)

< scroll down to DEPENDENCIES >
DEPENDENCIES
bcrypt!
devise (~> 4.3)

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

To commandline:
gem uninstall bcrypt
bundle install

@Holmesmichael

This comment has been minimized.

Show comment
Hide comment
@Holmesmichael

Holmesmichael Mar 30, 2018

@ohiodn8 Your solution is the only one that would work. I can now move forward with my project, thanks.

Holmesmichael commented Mar 30, 2018

@ohiodn8 Your solution is the only one that would work. I can now move forward with my project, thanks.

@aashishg

This comment has been minimized.

Show comment
Hide comment
@aashishg

aashishg Apr 22, 2018

@ohiodn8 Works! Thanks!

aashishg commented Apr 22, 2018

@ohiodn8 Works! Thanks!

@ChrisCavs

This comment has been minimized.

Show comment
Hide comment
@ChrisCavs

ChrisCavs May 1, 2018

You may have tried this already, but after install bcrypt you have to restart your server. Had the same issue you described, and nothing worked for me unless I restarted server after each install. Hope it helps.

ChrisCavs commented May 1, 2018

You may have tried this already, but after install bcrypt you have to restart your server. Had the same issue you described, and nothing worked for me unless I restarted server after each install. Hope it helps.

@johnnyshields

This comment has been minimized.

Show comment
Hide comment
@johnnyshields

johnnyshields May 1, 2018

^^^ yes we all know the workaround. we want the real issue to be fixed!

johnnyshields commented May 1, 2018

^^^ yes we all know the workaround. we want the real issue to be fixed!

tjschuck added a commit that referenced this issue May 9, 2018

Use AppVeyor for testing Windows gem installs
Notably, this is _not_ using AppVeyor for running the tests like you'd typically expect from CI.

Our big issue with Windows historically isn't running the tests, it's actually installing the gem.  This just leverages AppVeyor's infrastructure to let us try to install the bcrypt gem on Windows across all versions of Ruby that we intend to support.

See:

- #139
- #141
- #142
- #149
- ...plus countless others 😓

This doesn't actually fix the issue (that comes from me repackaging the gem and pushing the versions with new binaries), but it _does_ give us an indication that it's working.  I made this intentionally work with "prerelease" versions of the gem, so I can push up `.rc` versions to test without fully pushing out (possibly still broken) new versions.
@cocaholic-communist

This comment has been minimized.

Show comment
Hide comment
@cocaholic-communist

cocaholic-communist May 12, 2018

Despite using and following all the methods you all suggested, I am unable to use bcrypt successfully.
p.s.:I have installed and uninstalled bcrypt gem for almost a day and it still failed to work.

cocaholic-communist commented May 12, 2018

Despite using and following all the methods you all suggested, I am unable to use bcrypt successfully.
p.s.:I have installed and uninstalled bcrypt gem for almost a day and it still failed to work.

@cocaholic-communist

This comment has been minimized.

Show comment
Hide comment
@cocaholic-communist

cocaholic-communist May 12, 2018

I have also been taking measures,for example, I restarted the server, changed the gem, install and uninstalled the gem and so on and so forth.This is indeed frustrating and unbelievable.I hope action would be taken with immediate effect.Thank you.

cocaholic-communist commented May 12, 2018

I have also been taking measures,for example, I restarted the server, changed the gem, install and uninstalled the gem and so on and so forth.This is indeed frustrating and unbelievable.I hope action would be taken with immediate effect.Thank you.

@tjschuck

This comment has been minimized.

Show comment
Hide comment
@tjschuck

tjschuck May 15, 2018

Collaborator

I have just pushed version 3.1.12.rc1 to RubyGems.org which should solve this problem.

Can someone please confirm that gem install bcrypt --prerelease now works on Windows? If so, I'll push out the final version.

Collaborator

tjschuck commented May 15, 2018

I have just pushed version 3.1.12.rc1 to RubyGems.org which should solve this problem.

Can someone please confirm that gem install bcrypt --prerelease now works on Windows? If so, I'll push out the final version.

@tjschuck

This comment has been minimized.

Show comment
Hide comment
@tjschuck

tjschuck May 16, 2018

Collaborator

Version 3.1.12 of the bcrypt gem, which should fix this issue, was just pushed to RubyGems.

You should now be able to gem install bcrypt on Windows with none of the above workarounds.

Thanks, everyone!

Collaborator

tjschuck commented May 16, 2018

Version 3.1.12 of the bcrypt gem, which should fix this issue, was just pushed to RubyGems.

You should now be able to gem install bcrypt on Windows with none of the above workarounds.

Thanks, everyone!

@tjschuck tjschuck closed this May 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment