简体   繁体   English

LoadError:无法在Windows 2008 x64服​​务器上加载此类文件--bcrypt_ext

[英]LoadError: cannot load such file — bcrypt_ext on Windows 2008 x64 server

I upgraded my environment from Ruby 2.0.0 to 2.2.3. 我将我的环境从Ruby 2.0.0升级到2.2.3。

I also upgraded (overwrite) DevKit, and re-run ruby dk.rb install. 我还升级(覆盖)DevKit,并重新运行ruby dk.rb install。

I removed Gemfile.lock and ran bundle install to start with a brand new environment. 我删除了Gemfile.lock并运行bundle install以开始全新的环境。 Everything looks ok, but I get the error: 一切看起来都不错,但我收到错误:

E:\Projects\development\Stairs>rake db:migrate 
rake aborted!
LoadError: cannot load such file -- bcrypt_ext
E:/Projects/development/Stairs/config/application.rb:7:in `<top (required)>'
E:/Projects/development/Stairs/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- 2.2/bcrypt_ext
E:/Projects/development/Stairs/config/application.rb:7:in `<top (required)>'
E:/Projects/development/Stairs/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

I first had the same issue with Nokogiri, which I solved using this solution : Nokogiri load error using Juloi Elixir's solution and installing Nokogiri from a local copy. 我第一次遇到与Nokogiri相同的问题,我使用这个解决方案解决了: Nokogiri使用Juloi Elixir的解决方案加载错误并从本地副本安装Nokogiri。

But I don't feel like doing this foreach gem! 但我不想做这个foreach宝石! It looks like ruby is searching the gem using a ./ or ./2.2 path, while gems are stored in a ./2.2.0 path. 看起来ruby正在使用./或./2.2路径搜索gem,而gem则存储在./2.2.0路径中。 Is this configurable? 这是可配置的吗? How can I solve this issue? 我该如何解决这个问题?

Note: Gemfile contains gem 'bcrypt', '~> 3.1.10'

Thanks! 谢谢!

I spent an entire hour fixing this, just now. 我刚刚花了整整一个小时来解决这个问题。

Well what I did was I followed some advice online to do a 我做的是我在网上做了一些建议

gem install bcrypt --platform=ruby

And then, it worked in irb. 然后,它在irb中工作。

irb(main):001:0> require 'bcrypt'
=> true

Later when I had to do a bundle install, for some odd reason rails installed another bcrypt and the error was back. 后来当我不得不进行捆绑安装时,由于一些奇怪的原因,rails安装了另一个bcrypt并且错误又回来了。 So I had two folders in my gem root. 所以我的宝石根中有两个文件夹。

bcrypt-3.1.10
bcrypt-3.1.10-x64-mingw32

So, since the first folder was the one that got built with the devkit, and it works. 因此,由于第一个文件夹是使用devkit构建的文件夹,因此它可以工作。 I deleted the contents of the second folder and copied the contents of the first into it. 我删除了第二个文件夹的内容,并将第一个文件夹的内容复制到其中。

Seems to be working as I'm writing this. 似乎在工作,因为我正在写这篇文章。

Solution was here: bcrypt-ruby@github : 解决方案在这里: bcrypt-ruby @ github

Rebuild locally the bcrypt gem: 在本地重建bcrypt gem:

  1. Change to the gem directory \\Ruby22-x64\\lib\\ruby\\gems\\2.2.0\\gems\\bcrypt-3.1.10-x64-mingw32\\ext\\mri> 更改为gem目录\\ Ruby22-x64 \\ lib \\ ruby​​ \\ gems \\ 2.2.0 \\ gems \\ bcrypt-3.1.10-x64-mingw32 \\ _xt \\ mri>
  2. Run ruby extconf.rb 运行ruby extconf.rb
  3. Run make 运行make
  4. Run make install 运行make install

Note that this works only if your DevKit environment is correctly setup (run devkitvars.bat). 请注意,只有正确设置了DevKit环境(运行devkitvars.bat),这才有效。

@user1185081 's solution worked for me in a windows machine. @ user1185081的解决方案适用于Windows机器。 I ran following commands and worked like magic: 我运行了以下命令并像魔术一样工作:

$ cd C:\RailsInstaller\Ruby2.2.0\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x86-mingw32\ext\mri  
$ ruby extconf.rb
$ C:\<DevKit Path>\devkitvars.bat  (assuming you have devkit installed)(Ran this instead of running "make" because it was not recognized as an internal or external command)
$ make install

What worked for me on Windows 7: 在Windows 7上对我有用的是:

  1. gem uninstall bcrypt to uninstall all versions of bcrypt, including those listed as dependencies gem uninstall bcrypt卸载所有版本的bcrypt,包括那些列为依赖项的版本
  2. gem install bcrypt to reinstall gem install bcrypt重新安装
  3. bundle install

In my case, a designating of the old version to bcrypt in Gemfile was a cause of the error. 在我的例子中,在Gemfile中将旧版本指定为bcrypt是导致错误的原因。 I removed a designating of the version and run bundle update bcrypt , then it was settled. 我删除了版本的指定并运行bundle update bcrypt ,然后就解决了。

Here is the solution worked for me: 这是我的解决方案:

    C:\> gem uninstall brcypt
    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

I had the same problem: 我有同样的问题:

cannot load such file — bcrypt_ext 无法加载此类文件--bcrypt_ext


Windows 8.1 64bit Windows 8.1 64位

ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32] ruby 2.3.3p222(2016-11-21修订版56859)[i386-mingw32]

Rails 5.1.4 Rails 5.1.4


My solution: 我的解决方案

  1. gem uninstall bcrypt-ruby 宝石卸载bcrypt-ruby
  2. gem uninstall bcrypt 宝石卸载bcrypt
  3. gem install bcrypt –platform=ruby gem install bcrypt -platform = ruby
  4. added this whole line to Gemfile: 将这整行添加到Gemfile中:

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

  1. bundle install 捆绑安装

这适用于我,将其添加到您的gems文件:

gem 'bcrypt', '~> 3.1.7', platform: :ruby

This process is for windows: 这个过程适用于windows:

The problem is with the programs installed on the system. 问题在于系统上安装的程序。

Uninstall all rails programs: 卸载所有rails程序:

  1. All Ruby programs. 所有Ruby程序。

  2. RailsInstaller. RailsInstaller。

Removes all files that have been able to uninstall, you have to do it manually inside: 删除所有已卸载的文件,您必须在内部手动执行:

C:\\RailsInstaller C:\\ RailsInstaller

  1. Install de ruby version 2.2 from: 从以下位置安装de ruby​​ 2.2版:

http://railsinstaller.org/en http://railsinstaller.org/en

Wait a moment and it's already to go. 等一下,它已经去了。

MarlonJon.es MarlonJon.es

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM