创建了新的Rails应用程序,无法在Heroku上启动并收到错误

时间:2017-06-02 02:21:45

标签: ruby-on-rails ruby heroku

创建了一个新的rails 5应用程序,只有一个控制器用于静态页面,我正在尝试将其推送到Heroku开始。我不确定是什么导致heroku上的错误。无法找到任何具体信息。可能导致问题的原因是什么?

Heroku Logs

2017-06-02T02:10:53.461595+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nameless-hamlet-31215.herokuapp.com request_id=e9e76236-08c3-4ae7-a6a8-35edf8897476 fwd="162.200.138.225" dyno= connect= service= status=503 bytes= protocol=https
2017-06-02T02:10:54.766544+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nameless-hamlet-31215.herokuapp.com request_id=9ff158f8-0816-4c8b-b754-3d86a0000bc2 fwd="162.200.138.225" dyno= connect= service= status=503 bytes= protocol=https

Heroku Rails控制台

Running rails console on ⬢ nameless-hamlet-31215... up, run.9398 (Free)
/app/vendor/bundle/ruby/2.3.0/gems/pg-0.20.0/lib/pg.rb:4:in `require': libruby.so.2.3: cannot open shared object file: No such file or directory - /app/vendor/bundle/ruby/2.3.0/gems/pg-0.20.0/lib/pg_ext.so (LoadError)

宝石文件

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.3'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# 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.2'
# 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 navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'

# 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', platform: :mri
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.0.5'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

1 个答案:

答案 0 :(得分:0)

您可以尝试以下方法:

  1. 尝试重新启动应用程序,如果它可以正常运行...... [/ li>!
  2. 因为它是一个pg错误,请尝试运行rake命令*

    rake db:create

    rake db:setup

    rake db:reset

    rake db:migrate

  3. *不要一次全部运行它们,运行一个并检查错误消息是否发生变化。

    1. 最后,评论pg gem和bundle并再次推送。
    2. 希望有所帮助......

      <强>更新

      我刚刚意识到,您是否已将 heroku postgres 插件添加到您的应用中?转到仪表板,如果没有,请添加。