[英]Heroku rails deployment “at=error code=H10 desc=”App crashed"
I am trying to deploy my Rails app on Heroku however I face two h10 errors: 我正在尝试在Heroku上部署我的Rails应用程序,但是我遇到两个h10错误:
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" ... dyno= connect= service= status=503 bytes= protocol=https
and 和
at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" ... dyno= connect= service= status=503 bytes= protocol=https
As I read in other posts I ran heroku console
. 当我在其他文章中阅读时,我运行了
heroku console
。
I got this answer: 我得到了这个答案:
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined local variable or method `acts_as_votable' for Comment (call 'Comment.connection' to establish a connection):Class (NameError)
When I am doing a heroku run rake db:migrate
, I get this: 当我做一个
heroku run rake db:migrate
,我得到了:
rake aborted!
NameError: uninitialized constant ForestLiana`
Here is my Gemfile
: 这是我的
Gemfile
:
source 'https://rubygems.org'
ruby '2.3.0'
gem 'rails', '4.2.6'
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
gem 'rails_12factor'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bcrypt', '~> 3.1.7'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
gem 'forest_liana'
gem 'acts_as_votable', '~> 0.10.0'
end
Is it due to gem version? 是因为宝石版本吗? How can I solve this issue?
我该如何解决这个问题?
When deploying code to Heroku, it does not install gems defined in the :development
group in your Gemfile
since those gems are usually not needed when actually running your application in production. 将代码部署到Heroku时,它不会安装
Gemfile
中的:development
组中定义的Gemfile
因为在生产环境中实际运行应用程序时通常不需要这些gem。
In your case however, you have added the acts_as_votable
gem in the development group. 但是,根据您的情况,您已在开发组中添加了
acts_as_votable
gem。 Since your models are relying on it, you should define it outside of any group in your Gemfile
so that it is always installed. 由于您的模型依赖于它,因此您应该在
Gemfile
的任何组之外定义它,以便始终安装它。
When checking your stacktrace, you can see that the acts_as_votable
method you call on your Comment
class is not available on Heroku. 检查堆栈跟踪时,您可以看到在Heroku上不可用在
Comment
类上调用的acts_as_votable
方法。 This could give you the hint that the gem adding this method is either not installed or is not loaded somehow. 这可能会提示您添加此方法的gem未安装或未以某种方式加载。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.