【问题标题】:missing required flag heroku tail缺少必需的标志 heroku tail
【发布时间】:2018-07-19 16:41:26
【问题描述】:

我正在部署我的 rails 应用程序。一切都在本地环境中运行,但我在第一次推动 heroku 时遇到了一些问题。我收到标准应用程序错误,请参见图片:

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

我的 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

【问题讨论】:

  • 呃。图片。现在我无法复制和粘贴。双重呃。错误显示missing required flag app。您是否尝试过提供--app 或使用--remote
  • 对照片感到抱歉,没有意识到那是一个呃不会再做的事

标签: ruby-on-rails github heroku


【解决方案1】:

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

gem 'pg', '~> 0.18.4'

【讨论】:

    【解决方案2】:

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

    heroku logs --tail --app my_heroku_app_name
    

    另外,您似乎有嵌套的 gem 组。我假设您使用 postgresql 作为生产数据库,所以我建议将 pg 移出 development>production 组,如下所示:

    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
    

    【讨论】:

    • 当我运行 --tail --app 我现在得到以下内容无法设置未定义的属性“登录”
    猜你喜欢
    • 2019-01-19
    • 1970-01-01
    • 2020-01-27
    • 1970-01-01
    • 2021-09-18
    • 2022-10-14
    • 1970-01-01
    • 2018-02-03
    • 1970-01-01
    相关资源
    最近更新 更多