缺少必需的标志heroku尾巴

时间:2018-02-09 00:21:13

标签: ruby-on-rails github heroku

我正在努力部署我的rails应用。在本地环境中运行的所有东西,但是我在第一次推送到heroku时遇到了一些问题。我收到标准应用程序错误,请参阅图片:

enter image description here

当我运行命令heroku logs --tail时,我收到以下错误:

enter image description here

我的gemfile如下:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record

# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  gem 'sqlite3'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  group :production do
     gem 'pg'
end

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end
下面是我的heroku日志:

2

018-02-09T00:48:11.108425+00:00 app[web.1]:     from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'

2018-02-09T00:48:11.108427+00:00 app[web.1]:    from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'

2018-02-09T00:48:11.108435+00:00 app[web.1]:    from bin/rails:3:in `load'

2018-02-09T00:48:11.108437+00:00 app[web.1]:    from bin/rails:3:in `<main>'

2018-02-09T00:48:11.120606+00:00 app[web.1]: => Booting WEBrick

2018-02-09T00:48:11.120615+00:00 app[web.1]: => Rails 4.2.6 application starting in production on http://0.0.0.0:52651

2018-02-09T00:48:11.120619+00:00 app[web.1]: => Ctrl-C to shutdown server

2018-02-09T00:48:11.120618+00:00 app[web.1]: => Run `rails server -h` for more startup options

2018-02-09T00:48:11.120621+00:00 app[web.1]: Exiting

2018-02-09T00:49:30.407211+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=postcable.herokuapp.com request_id=ec520950-df52-44ee-95aa-890d9ad76949 fwd="67.20.250.6" dyno= connect= service= status=503 bytes= protocol=https

2018-02-09T00:49:32.372812+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=postcable.herokuapp.com request_id=ffdb944b-9293-4d96-8986-b0af2974704c fwd="67.20.250.6" dyno= connect= service= status=503 bytes= protocol=https

2 个答案:

答案 0 :(得分:5)

首先,要使日志错误正常工作,还要为您的应用名称传递一个标志:

heroku logs --tail --app my_heroku_app_name

此外,您似乎已嵌套宝石组。我假设您使用postgresql作为生产数据库,因此我建议将pg移出开发&gt;生产组,如下所示:

gem 'pg'

group :development do
  gem 'sqlite3'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
end

然后运行

bundle install

最后,尝试使用

再次推送到heroku
git push heroku master

答案 1 :(得分:0)

我解决了,需要在我的gemfile中定义PG版本:

gem 'pg', '~> 0.18.4'