简体   繁体   English

在Heroku中使用Ruby Bcrypt

[英]Using Ruby Bcrypt with Heroku

Have a Ruby on Rails app that uses BCrypt to hash passwords, the User model has 有一个使用BCrypt哈希密码的Ruby on Rails应用程序,用户模型具有

require "BCrypt"

and the gemfile has gemfile有

gem 'bcrypt-ruby'

This all works fine when running locally, however when I deploy it to my Heroku server I get the following error 在本地运行时,这一切都很好,但是当我将其部署到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=

I'm assuming the problem is the No such file to load -- BCrypt (LoadError) but can't seem to fix it, bundle install and bundle update work fine and it says bcrypt-ruby is installed OK. 我假设问题是No such file to load -- BCrypt (LoadError)但似乎无法修复, bundle installbundle update工作正常,它说bcrypt-ruby已安装确定。
Any ideas how I could go about fixing this? 有什么想法可以解决这个问题吗? I'm all out! 我全力以赴!

Thanks 谢谢

Just posting this answer to help any others finding this page. 只需发布此答案即可帮助其他任何人找到此页面。 The correct answer is in the comments to the question, by in @eugen. 正确的答案是在问题的注释中@eugen。

The problem was capitalisation, as I'm developing on Windows, it doesn't care about capitalisation, but on the Heroku (UNIX) server it does, and I should have used 'bcrypt' instead of 'BCrypt'. 问题是大写,因为我在Windows上开发时,它并​​不关心大写,但是在Heroku(UNIX)服务器上却要大写,因此我应该使用“ bcrypt”而不是“ BCrypt”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM