replace_gem中的block无法激活bcrypt-ruby(〜3.0.0),已经激活了bcrypt-ruby-3.1.1 [英] block in replace_gem can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.1

查看:111
本文介绍了replace_gem中的block无法激活bcrypt-ruby(〜3.0.0),已经激活了bcrypt-ruby-3.1.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经查看了有关此问题的几个答案,但似乎没有一个解决之道.这是在Windows上,我迷失了主意.感谢您的帮助!

I've looked at several answers regarding this problem and none seem to do the trick. This is on windows and I am lost for ideas. Thanks for the help!

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'

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:in block in require' 从C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:在each' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in require' 从C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:在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:在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:在load' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:in中加载块 _spec_files' 从C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:在each' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:in load_spec_fil中 es' 从C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/command_line.rb:22:在run' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/runner.rb:80:in run'中 从C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/runner.rb:17:在'自动运行中阻止'

' from 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' from 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' from 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' from 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' from 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' from 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' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:in load' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:inblock in load _spec_files' from 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_fil es' from C:/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' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/runner.rb:17:in `block in autorun'

推荐答案

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

I just solved the same problem on my project.

问题在于,在3.1.1版中不支持方法"has_secure_password",因此在3.1.1版中的模型中调用该方法将无效. 但是,如此处所述-> bcrypt错误:devise ruby 2.0和Rails 4.0 ,仅在gemfile中指定版本是行不通的,因为将使用Windows兼容版本,这将导致问题.

The problem is that in version 3.1.1 the method 'has_secure_password' is not supported, so calling it in your model while in version 3.1.1 will not work. However, as mentioned here -> bcrypt error: Devise ruby 2.0 and rails 4.0, simply specifying a version in the gemfile won't work, because a windows compatible version will be used, which causes it's own issues.

我的解决方案是派生bcrypt-ruby的github存储库,然后将其回滚至3.0.1版本,并将其用作gem的源,如下所示:

My solution was to fork the bcrypt-ruby's github repo, then roll it back to 3.0.1 version and use that as the source for the gem, like this:

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

您受邀使用我的存储库:)

You're invited to use my repo :)

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

Hopefully these issues will be fixed soon.

这篇关于replace_gem中的block无法激活bcrypt-ruby(〜3.0.0),已经激活了bcrypt-ruby-3.1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆