【问题标题】:cannot load such file -- 1.9/bcrypt_ext (LoadError)无法加载此类文件 -- 1.9/bcrypt_ext (LoadError)
【发布时间】:2013-07-08 21:54:13
【问题描述】:

嘿,当我尝试启动 rails 服务器时出现以下错误

有什么想法吗?目前没有可行的解决方案...

顺便说一句,我运行 Windows 8... 可能根本就是问题所在:D

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- 1.9/bcry
pt_ext (LoadError)
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bcrypt-ruby-3.1.0-x86-mingw32/lib/bcrypt_ext.rb:2:in `<top (required)>'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bcrypt-ruby-3.1.0-x86-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `each'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `block in require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `each'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler.rb:132:in `require'
    from C:/Users/Enno/RubymineProjects/BookWriting2.0/config/application.rb:13:in `<top (required)>'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:24:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:24:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

【问题讨论】:

  • 我在 Windows 7 上运行也遇到了同样的问题,“无法加载此类文件 — 1.9/bcrypt_ext (LoadError)”
  • 您可能希望在完成上述更改后重新启动本地服务器 - 这可能会为您节省一些时间。

标签: ruby-on-rails ruby activerecord devise bcrypt


【解决方案1】:

今天早上,我也面临同样的问题(Windows 7)。 让我推荐看看这里 https://github.com/codahale/bcrypt-ruby/issues/72

我成功地解决了这样的问题(更新我的 Gemfile):

gem 'bcrypt-ruby', '3.1.1.rc1', :require =&gt; 'bcrypt'

【讨论】:

  • 仅供参考,官方 bcrypt-ruby 3.1.1 已发布(包括此修复)
  • 相关版本会不断变化。你可以在这里找到最新的稳定版本号:rubygems.org/gems/bcrypt-ruby
【解决方案2】:

如果您在使用 gem bcrypt 时遇到问题,请按照以下步骤操作:

1. 切换到bundle show bcrypt+ext\mri\找到的gem目录,例如:c:\RailsInstaller\Ruby2.2.3\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x86-mingw32\ext\mri

2.运行ruby extconf.rb

3.运行make

4. make install

请注意,这仅在您的 DevKit 环境设置正确(运行 devkitvars.bat)时才有效。

【讨论】:

  • 就是这样。我的 DevKit 路径没有设置,所以 bcrypt 没有构建。我必须将C:\DevKit2\bin;C:\DevKit2\mingw\bin 添加到我的路径中。这些其他答案很愚蠢。设计甚至不依赖于bcrypt-rubyrubygems.org/gems/devise 他们所做的只是添加另一个依赖于 bcrypt 的 gem,也许这次它会构建,也许不会。
【解决方案3】:

我遇到了类似的问题,但在 Windows 上使用 Ruby 2.0 和 Rails 3.2.15。现在至少需要 3.1.2:

gem 'bcrypt-ruby', '~> 3.1.2'

链接: https://github.com/rails/rails/pull/12325

【讨论】:

  • 工作!!非常感谢:)
【解决方案4】:

在你的 gemfile 中注释掉 "gem 'bcrypt-ruby', '~> 3.0.0'" 这应该是工作

【讨论】:

    【解决方案5】:

    相关版本会不断变化。你可以在这里找到最新的稳定版本号:rubygems.org/gems/bcrypt-ruby

    【讨论】:

      【解决方案6】:

      如果有人在 Windows 64 位上仍然遇到此问题(尤其是在设计方面),请尝试安装 Ruby 64 位,然后将 rails 作为 gem(而不是使用 rails 安装程序),然后添加: gem 'bcrypt-ruby', '~&gt; 3.0.0', :require =&gt; "bcrypt"

      您可能需要将您的 tzinfo-data gem 更改为: gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-30
      • 2015-01-22
      • 2012-10-25
      • 2020-12-05
      相关资源
      最近更新 更多