在replace_gem块无法激活bcrypt-红宝石(〜> 3.0.0),已经激活bcryp

2019-10-18 09:29发布

我已经看了关于这个问题,并没有几个答案似乎这样的伎俩。 这是Windows,我无事可做。 谢谢您的帮助!

C:/Ruby200/lib/ruby/gems/2.0.0/gems/bcrypt-ruby-3.0.1-x86-mingw32/lib/bcrypt_ext.rb:2:在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:在each' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in从下在需要”块:/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:in需要'从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:在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:在require' from C:/Users/Natecraft/Documents/railstut/Nate_Enddy_d3/blog/spec/spec_helper.rb:3:in从C:/用户/ Natecraft /文档/ railstut / Nate_Enddy_d3 /博客/规格/模式 LS / 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 /红宝石/宝石/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:in在负载_spec_files'选自C块:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/ LIB / rspec的/核心/ 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从C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/command_line.rb:22:在load_spec_fil ES run' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/runner.rb:80:in从C运行”:/ Ruby200 / LIB /红宝石/宝石/2.0.0/gems/rspec-core-2.14.3/lib/rspec/core/runner.rb:17:in`块中自动运行”

Answer 1:

我只是解决了我的项目同样的问题。

问题是,在3.1.1版本的方法“has_secure_password”不支持,所以称它在你的模型,而在3.1.1版本将无法正常工作。 但是,这里所说- > bcrypt错误:制定红宝石2.0和4.0轨道 ,只需在指定的Gemfile中是行不通的一个版本,因为Windows兼容版本将被使用,这会导致它自己的问题。

我的解决办法是用叉子叉bcrypt-红宝石的GitHub库,然后回滚到3.0.1版本,并使用它作为源宝石,像这样的:

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

我们邀请您用我的回购:)

希望这些问题很快就会解决。



文章来源: block in replace_gem can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.1