FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BCrypt 3.1.11 (x86-mingw32): cannot load such file -- bcrypt_ext · Issue #149 · bcrypt-ruby/bcrypt-ruby · GitHub

Repository navigation

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

Description

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?

Activity

  1. changed the title [-]BCrypt 3.1.11 (x68-mingw32): cannot load such file -- bcrypt_ext[/-] [+]BCrypt 3.1.11 (x86-mingw32): cannot load such file -- bcrypt_ext[/+] on Feb 27, 2017
  2. fpauser commented on Mar 2, 2017

    Same problem here...

  3. gvescu commented on 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.

  4. TheFlow0360 commented on Mar 6, 2017

    Author

    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.

  5. scivola commented on Mar 6, 2017

    How about this?

    gem list bcrypt
    
  6. TheFlow0360 commented on Mar 6, 2017

    Author

    what about it? It outputs the gems:

    gem list bcrypt

    *** LOCAL GEMS ***

    bcrypt (3.1.11)

  7. scivola commented on 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 ?

  8. TheFlow0360 commented on Mar 6, 2017

    Author

    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.

  9. TheFlow0360 commented on Mar 7, 2017

    Author

    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?

  10. Goku-San commented on 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

  11. gaumondia commented on 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!

  12. TheFlow0360 commented on Mar 20, 2017

    Author

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

  13. dersuercan commented on 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.

  14. TheFlow0360 commented on Mar 23, 2017

    Author

    @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!

  15. Goku-San commented on 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...

  16. 14 remaining items

  17. Tommyleerom commented on Mar 13, 2018

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

  18. bodrovis commented on 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.

  19. watta90 commented on 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?

  20. Tommyleerom commented on Mar 22, 2018

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

  21. ohiodn8 commented on 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

  22. Holmesmichael commented on Mar 30, 2018

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

  23. aashishg commented on Apr 22, 2018

    @ohiodn8 Works! Thanks!

  24. ChrisCavs commented on 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.

  25. johnnyshields commented on May 1, 2018

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

  26. cocaholic-communist commented on 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.

  27. cocaholic-communist commented on 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.

  28. tjschuck commented on 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.

  29. tjschuck commented on 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!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL