1

我已经查看了有关此问题的几个答案,但似乎没有一个可以解决问题。这是在窗户上,我迷失了想法。谢谢您的帮助!

C:/Ruby200/lib/ruby/gems/2.0.0/gems/bcrypt-ruby-3.0.1-x86-mingw32/lib/bcrypt_ext.rb:2:in require': cannot load such fil e -- 2.0/bcrypt_ext (LoadError) from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bcrypt-ruby-3.0.1-x86-mingw32/lib/bcrypt_ext.rb:2:in'

    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bcrypt-ruby-3.0.1-x86-mingw32/lib/bcrypt.rb:12:in `require'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bcrypt-ruby-3.0.1-x86-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require

'来自 C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in each' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:inblock in require' 来自 C:/Ruby200/lib/ruby/ gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in each' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:inrequire' 来自 C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5 /lib/bundler.rb:132:in require' from C:/Users/Natecraft/Documents/railstut/Nate_Enddy_d3/blog/config/application.rb:12:in'来自 C:/Users/Natecraft/Documents/railstut/Nate_Enddy_d3/blog/config/environment.rb:2:in require' from C:/Users/Natecraft/Documents/railstut/Nate_Enddy_d3/blog/config/environment.rb:2:in' 来自 C:/Users/Natecraft/Documents/railstut/Nate_Enddy_d3 /blog/spec/spec_helper.rb:3:in require' from C:/Users/Natecraft/Documents/railstut/Nate_Enddy_d3/blog/spec/spec_helper.rb:3:in'来自 C:/Users/Natecraft/Documents/railstut/Nate_Enddy_d3/blog/spec/models/user_spec.rb:1:in require' from C:/Users/Natecraft/Documents/railstut/Nate_Enddy_d3/blog/spec/models/user_spec.rb:1:in'来自 C:/Ruby200/lib/ruby /gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:inload' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:in阻止从 C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:in each' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:inload_spec_files' 从 C 加载 _spec_files': /Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/command_line.rb:22:in run' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/runner.rb:80:inrun' 来自 C:/Ruby200/lib/ruby/gems/ 2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/runner.rb:17:in `block in autorun'

4

1 回答 1

1

我刚刚在我的项目中解决了同样的问题。

问题是在版本 3.1.1 中不支持方法“has_secure_password”,因此在版本 3.1.1 中在模型中调用它将不起作用。但是,正如这里提到的 -> bcrypt error: Devise ruby​​ 2.0 and rails 4.0,简单地在 gemfile 中指定一个版本是行不通的,因为将使用与 windows 兼容的版本,这会导致它自己的问题。

我的解决方案是分叉 bcrypt-ruby 的 github repo,然后将其回滚到 3.0.1 版本并将其用作 gem 的源,如下所示:

gem 'bcrypt-ruby', git: 'git@github.com:hananamar/bcrypt-ruby.git', :require => 'bcrypt'

邀请您使用我的回购 :)

希望这些问题将很快得到解决。

于 2013-08-06T10:11:22.417 回答