无法加载此类文件 - 1.9 / bcrypt_ext(LoadError)

时间:2013-07-08 21:54:13

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

嘿,当我尝试启动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>'

6 个答案:

答案 0 :(得分:18)

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

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

gem 'bcrypt-ruby', '3.1.1.rc1', :require => 'bcrypt'

答案 1 :(得分:4)

如果您对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)时才有效。

答案 2 :(得分:2)

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

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

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

答案 3 :(得分:-1)

在你的gemfile中评论“gem'bcrypt-ruby','〜&gt; 3.0.0'” 这应该是工作

答案 4 :(得分:-1)

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

答案 5 :(得分:-1)

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

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