You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BCrypt 3.1.11 (x86-mingw32): cannot load such file -- bcrypt_ext #149
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)
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.
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
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.
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?
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
Reacted by Aashish Ippili, Shreyas Joshi, Brevis, Alex Strizhak, Ian Bravo, Adam Lu, Ramesh Kumar, Maksim Loginov, Patricia Allauca and Ngoc Nguyen
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.
Reacted by Florian Koch, bamchoh, Alison R. Wu, tanyaru21, Make Happen, apocryphal, Deniz Simsek, Matthew Spero, Eric Schoettle, Energy and 5 more
Reacted by Energy, Ana Karoliny and lethunder
Reacted by tanyaru21, William Wilson, jetstreamj and Ashkan Ebtekari
Reacted by Dawid Ciok, tanyaru21, Mahdi Shadkam-Farrokhi, Bernard Matic Lomo, jetstreamj, Steven Iglesias, Hao Le and Giovane Luiz Starch Perlin
@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 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...
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:
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)!
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
Here, run ruby extconf.rb
Then make
Then make install
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.
Reacted by Simon Kaluza, Tommy Lee , Alex Strizhak, Bogdan and Udi
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?
(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
Reacted by Johnny Franjo and Gregory Jaros
Reacted by Michael Holmes, akatriel, Aashish Gangwani and Johnny Franjo
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.
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.
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.
Activity
[-]BCrypt 3.1.11 (x68-mingw32): cannot load such file -- bcrypt_ext[/-][+]BCrypt 3.1.11 (x86-mingw32): cannot load such file -- bcrypt_ext[/+]fpauser commentedon Mar 2, 2017
Same problem here...
gvescu commentedon Mar 4, 2017
Just got this issue again. The only solution right now is to run:
I suppose it's just a temporary fix.
TheFlow0360 commentedon 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_passwordthe exception still occurs.scivola commentedon Mar 6, 2017
How about this?
TheFlow0360 commentedon Mar 6, 2017
what about it? It outputs the gems:
scivola commentedon 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 commentedon Mar 6, 2017
Subfolder
jrubyjust contains another folderbcrypt_jrubywith aBCrypt.java, other folder ismriwith the following content:Sorry for the bad formatting, the tabs are getting truncated.
TheFlow0360 commentedon Mar 7, 2017
I just noticed, when really uninstalling and reinstalling bcrypt it works, the problem is that after running
bundler installthe wrong bcrypt get's installed. I just don't understand why.Installing with
gem install bcrypt --platform=rubyis working, and my gemfile containsgem 'bcrypt', '~> 3.1.7', platforms: :rubybut breaks the installation. What do I need to write there to be equivalent?Goku-San commentedon 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 runbundle install... after that UnCommentedgem 'bcrypt', '3.1.11', platforms: [:ruby, :x64_mingw]and againbundle installand that's it. Hope this helps someone..P.S
:x64_mingwis for 64x Windows. I am on win7x64gaumondia commentedon 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 commentedon Mar 20, 2017
@gaumondia yeah but referencing the github version isn't exactly something I want to do when the project goes into production...
dersuercan commentedon Mar 23, 2017
I solved it based on hellriders solution.First of all comment out
# gem bcrypt, '3.1.11'and runbundle install.After that uninstall the gem withgem uninstall bcrypt.Then re-installgem install bcrypt --platform=ruby.The important part, un-commentgem '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 beforebundle installand then un-comment.I hope it will be fixed soon, it is so dumb.TheFlow0360 commentedon 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 commentedon 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 againSo 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...
14 remaining items
Tommyleerom commentedon Mar 13, 2018
Is there any solution that for good and all fix the problem on windows?
bodrovis commentedon 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:PATHshould also containc:\devkit\mingw\binpath (that hasmake.exefile)!cdinto the directory where BCrypt files reside. Something likec:\Ruby24\lib\ruby\gems\2.2.4\gems\bcrypt-3.1.11-x64-mingw32\ext\mriruby extconf.rbmakemake installbundle installjust in case). You don't need to add anyplatform: :rubystuff 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.watta90 commentedon 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-mingw32when I rungem 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 commentedon Mar 22, 2018
@bodrovis thanks man :) your solution works for me (windows 7- x64)
ohiodn8 commentedon 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 bcryptbundle installHolmesmichael commentedon Mar 30, 2018
@ohiodn8 Your solution is the only one that would work. I can now move forward with my project, thanks.
aashishg commentedon Apr 22, 2018
@ohiodn8 Works! Thanks!
ChrisCavs commentedon 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 commentedon May 1, 2018
^^^ yes we all know the workaround. we want the real issue to be fixed!
Use AppVeyor for testing Windows gem installs
cocaholic-communist commentedon 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 commentedon 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 commentedon 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 --prereleasenow works on Windows? If so, I'll push out the final version.tjschuck commentedon 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 bcrypton Windows with none of the above workarounds.Thanks, everyone!