[英]Ruby on Rails bcrypt-ruby error
我正在關注Michael Hartl的Rails 4教程,並且正在研究用戶身份驗證部分。 他說將bcrypt-ruby
添加到Gemfile中,然后bundle install
。
這是我的Gemfile中的代碼行:
gem 'bcrypt-ruby', '3.1.2' // as explained at http://ruby.railstutorial.org/chapters/modeling-users#code-bcrypt_ruby
我運行bundle install
,然后rails console
來測試系統。 創建新用戶會引發以下錯誤:
You don't have bcrypt-ruby installed in your application. Please add it to your Gemfile and run bundle install
Gem::LoadError: can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.2. Make sure all dependencies are added to Gemfile.
bundle install
正常,沒有引發任何錯誤bcrypt-ruby
為什么此操作失敗,並顯示錯誤消息,提示未安裝bcrypt-ruby
?
編輯:這似乎是這個問題的重復: 無法激活bcrypt-ruby(〜> 3.0.0),已經激活了bcrypt-ruby-3.1.2?
您需要bcrypt-ruby
版本3.0.0
更改您的Gemfile中的版本
gem 'bcrypt-ruby', '~> 3.0.0'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.