2014-04-12 268 views
2

我使用rvm ruby​​ 2.1.0運行最新的OSX。 bundle update後到Rails 4.1.0和3.4.1 authlogic,當我啓動服務器我得到這個錯誤:Rails 4.1.0和authlogic bcrypt問題

authlogic/crypto_providers/bcrypt.rb:1:in `require': cannot load such file -- bcrypt (LoadError) 
    authlogic-3.4.1/lib/authlogic/crypto_providers/bcrypt.rb:1:in `<top (required)>' 
    authlogic-3.4.1/lib/authlogic.rb:60:in `require' 
    authlogic-3.4.1/lib/authlogic.rb:60:in `block in <top (required)>' 
    authlogic-3.4.1/lib/authlogic.rb:59:in `each' 
    authlogic-3.4.1/lib/authlogic.rb:59:in `<top (required)>' 
    bundler-1.5.2/lib/bundler/runtime.rb:76:in `require' 
    bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require' 
    bundler-1.5.2/lib/bundler/runtime.rb:72:in `each' 
    bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require' 
    bundler-1.5.2/lib/bundler/runtime.rb:61:in `each' 
    bundler-1.5.2/lib/bundler/runtime.rb:61:in `require' 
    bundler-1.5.2/lib/bundler.rb:131:in `require' 
    application.rb:7:in `<top (required)>' 
    railties-4.1.0/lib/rails/commands/commands_tasks.rb:79:in `require' 
    railties-4.1.0/lib/rails/commands/commands_tasks.rb:79:in `block in server' 
    railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap' 
    railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server' 
    railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!' 
    railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>' 

回答

7

從這個issue在authlogic GitHub的帳戶

Authlogic已更改其默認加密系統從SHA512到SCrypt。

看來你需要這個在你的Gemfile

gem 'authlogic', '~> 3.4.0' 
gem 'scrypt' 

如果你不想SCrypt你可以把這個

acts_as_authentic do |c| 
    c.crypto_provider = Authlogic::CryptoProviders::Sha512 
end 

User.rb

您還可以使用SHA512可能需要指定authlogic gem的版本

gem 'authlogic', github: 'binarylogic/authlogic', ref: 'e4b2990d6282f3f7b50249b4f639631aef68b939' 

,但我想這將是儘快解決

+0

感謝,1。沒有工作(還是一樣的錯誤),2.沒有 – antpaw

+0

你能告訴我什麼是'Authlogic :: CryptoProviders :: SHA512 '在User.rb中做?如果我不添加它會發生什麼? – antpaw

+1

你應該嘗試刪除它。 Authlogic默認使用SCrypt,但沒有將其作爲依賴項。因此你必須在你的gemfile中包含scrypt。如果您不想切換到sCrypt,請使用'c.crypto_provider = Authlogic :: CryptoProviders :: Sha512'行。閱讀這裏[這裏](https://github.com/binarylogic/authlogic/issues/400#issuecomment-36611907)獲取更多信息 –