Ruby on windows causes error Unable to load such bcrypt_ext file

Trying to run ruby ​​on my Windows 7 machine whenever I switch to rails s or rake db: migrate I get the following error I cannot load such a bcrypt_ext file.

My ruby ​​version is 2.2.1. My rails version is 4.2.0 and the bcrypt version is 3.1.10. All stones are set correctly when I start the installation of the package, but whenever I try to rake it gives me this error. Any help would be greatly appreciated.

+6
source share
6 answers

You need to use what it says here: https://www.alib.jp/entries/bcrypt_ext_load_error_on_ruby21x

C:\> gem install --no-ri --no-rdoc bcrypt C:\> cd (path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> ruby extconf.rb C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> make C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> make install 
+16
source

Bcrypt 3.1.11 now works on Windows 10, on 24144

actions:

  • disable all rails servers
  • uninstall all versions of bcrypt
  • manually install v3.1.1 ( gem install bcrypt -v '3.1.11' )
  • update gem project files

current versions

  • ruby 2.2.4p230 (version 2015-12-16 53155) [i386-mingw32]

  • OS Name: Microsoft Windows 10 Pro

  • OS Version: 10.0.10586 N / A Build 10586

+4
source

A dirty quick workaround is to install the mri version using

gem install bcrypt --platform=ruby

worked for me.

Fetching: bcrypt-3.1.11.gem (100%) Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... Successfully installed bcrypt-3.1.11

Source: topac commented on April 17, 2015 https://github.com/codahale/bcrypt-ruby/issues/116

+2
source

I encounter the same problem in Window 8.1 64bit, Ruby 2.3.3 64bit, Rails 4.2.10.

My quick solution:

Step 1: Remove all bcrypt in gem: gem uninstall bcrypt (select option 3 if it exists (delete all))

Step 2: install bcrypt again: gem install bcrypt

Then check the bcrypt version: gem list bcrypt

Step 3: In the gemfile of your project add: gem 'bcrypt', '3.1.11', platforms: [:ruby, :x64_mingw] note: change the appropriate version of your bcrypt (my version: 3.1.11)

Step 4: Run the command in your project path: bundle install

Step 5: Remove the unnecessary bcrypt: Run command: gem uninstall bcrypt You can see some version of bcrypt, you must save one version: bcrypt- [your-version]. (Uninstall the whole version: bcrypt- [your version] -x64-mingw32. In my case, uninstall: bcrypt-3.1.11-x64-mingw32)

Restart Rails, execute

I think this is a suggestion because when we install bcrypt, we did not specify 64-bit or 32-bit, it is not compatible with a window or ruby ​​(64-bit or 32-bit)

+2
source

Most likely, compiled binaries do not contain binaries for Ruby 2.2.1 . This is because there is a problem with cross-compiling Ruby for Windows purpose. See this answer for more details.

An alternative to best is to upgrade to Ruby 2.1.5 .

You can try to collect the stone itself, but it is a completely different beast. In some cases, such as nokogiri , this is not even possible.

+1
source

Rich Peck's solution worked for me with a little update. Make sure devkit is included in the environment path (verify it by typing the path on the command line). If you do not enable it, you need to add devkit / bin and devkit / mingw / bin to your PATH var.

Otherwise - make: x86_64-w64-mingw32-gcc: The command was not found - an error will be issued when you create the file.

Once the error is fixed, I can solve the problem with the file and bcrypt_ext.

+1
source

Source: https://habr.com/ru/post/984300/


All Articles