ruby-on-rails - 缺少必需的标志 heroku tail

标签 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

最佳答案

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

heroku logs --tail --app my_heroku_app_name

此外,您似乎嵌套了 gem 组。我假设您使用 postgresql 作为生产数据库,因此我建议将 pg 移出开发>生产组,如下所示:
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

关于ruby-on-rails - 缺少必需的标志 heroku tail,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48696878/

相关文章:

java - 在 GitHub 上使用 Eclipse 建立 Java 项目的正确方法是什么

github - 在 CircleCI 中安装 GitHub 包

javascript - 在 Heroku 上使用 JavaScript 模块

ruby - 部署到 heroku 的 Watir 应用程序

ruby-on-rails - 如何将已下载的 Rails gem 链接到新版本的 Ruby?

ruby-on-rails - 调用方法,在Application controller中定义,在其他controller中

ruby-on-rails - 在 Ruby on Rails 中管理用户(和所有权)

reactjs - 在 github 页面上部署 Reactjs 网站并使用路由会导致刷新时出现 404 错误

ruby-on-rails - 在 Builder::XmlMarkup 中处理异常

java - Glassfish 上 Maven Web 应用程序的 Heroku Procfile 是什么?