1

有一个使用 BCrypt 哈希密码的 Ruby on Rails 应用程序,用户模型有

require "BCrypt"

并且gemfile有

gem 'bcrypt-ruby'

这在本地运行时一切正常,但是当我将它部署到我的 Heroku 服务器时,我收到以下错误

2012-11-16T14:42:32+00:00 app[web.1]: Exiting
2012-11-16T14:42:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
2012-11-16T14:42:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/engine.rb:436:in `eager_load!'
2012-11-16T14:42:32+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-11-16T14:42:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:312:in `depend_on'
2012-11-16T14:42:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:225:in `require_dependency'
2012-11-16T14:42:32+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:317:in `rescue in depend_on': No such file to load -- BCrypt (LoadError)
2012-11-16T14:42:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
2012-11-16T14:42:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
...
2012-11-16T14:42:32+00:00 app[web.1]:   from script/rails:6:in `<main>'
2012-11-16T14:42:33+00:00 heroku[web.1]: Process exited with status 1
2012-11-16T14:42:33+00:00 heroku[web.1]: State changed from crashed to down
2012-11-16T14:42:33+00:00 heroku[web.1]: State changed from starting to crashed
2012-11-16T14:42:34+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=smartaprofiles.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=

我假设问题是No such file to load -- BCrypt (LoadError)但似乎无法修复它,bundle install并且bundle update工作正常,它说 bcrypt-ruby 安装正常。
有什么想法可以解决这个问题吗?我都出来了!

谢谢

4

1 回答 1

0

只需发布此答案以帮助其他人找到此页面。正确答案在@eugen 对问题的评论中。

问题是大写,因为我在 Windows 上开发,它不关心大小写,但在 Heroku (UNIX) 服务器上它确实如此,我应该使用“bcrypt”而不是“BCrypt”。

于 2012-12-18T11:51:48.337 回答