15

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

6 回答 6

18

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

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

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

于 2013-07-10T10:22:37.960 回答
4

如果您对 gem 有问题bcrypt,请按照以下步骤操作:

1.切换到bundle show bcrypt+找到的 gem 目录ext\mri\,例如: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)时才有效。

于 2016-01-14T11:43:13.530 回答
2

I encountered a similar issue but with Ruby 2.0 and Rails 3.2.15 on Windows. It now requires at least 3.1.2:

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

Link: https://github.com/rails/rails/pull/12325

于 2013-11-28T16:39:38.660 回答
-1

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

于 2014-06-02T15:50:30.890 回答
-1

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

于 2013-07-09T08:24:56.237 回答
-1

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

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

于 2016-02-29T08:49:48.393 回答