質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

344閲覧

Rails tutorialで作成中のアプリをHerokuでデプロイ後Openしようとすると、Application errorになる

Shunpei0217

総合スコア15

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2019/05/27 16:08

どうしたらApplication errorが解決できるでしょうか?

Rails tutorialの第4章を終え、5章に入る前にブラウザ上で見た目を確認したいと思い、Herokuでアプリをデプロイし、その後heroku openを試してみました。
しかしブラウザには以下のようなメッセージが発生。
イメージ説明

詳細なエラーの原因を知る手段として、

heroku run rails console

があることを知ったので、実際にコマンドラインで試したところ、以下のようなエラー文が表示されました。

〜文字数の関係で省略〜 5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers' 62: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run' 61: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec' 60: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>' 59: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application/finisher.rb:69:in `each' 58: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:356:in `eager_load!' 57: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:475:in `eager_load!' 56: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:475:in `each' 55: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:477:in `block in eager_load!' 54: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:477:in `each' 53: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:478:in `block (2 levels) in eager_load!' 52: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:246:in `require_dependency' 51: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/active_support.rb:85:in `depend_on' 50: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:334:in `depend_on' 49: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/active_support.rb:47:in `require_or_load' 48: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry' 47: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in `block in require_or_load' 46: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:356:in `require_or_load' 45: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:37:in `load_interlock' 44: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:13:in `loading' 43: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/concurrency/share_lock.rb:151:in `exclusive' 42: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:14:in `block in loading' 41: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:37:in `block in load_interlock' 40: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:378:in `block in require_or_load' 39: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 38: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 37: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 36: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' 35: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi' 34: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 33: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi' 32: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require' 31: from /app/vendor/bundle/ruby/2.5.0/gems/activestorage-5.2.3/app/models/active_storage/attachment.rb:9:in `<main>' 30: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 29: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 28: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 27: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' 26: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi' 25: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 24: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi' 23: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require' 22: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/base.rb:27:in `<main>' 21: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/base.rb:328:in `<module:ActiveRecord>' 20: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks' 19: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:51:in `each' 18: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks' 17: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook' 16: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control' 15: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook' 14: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval' 13: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>' 12: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_handling.rb:60:in `establish_connection' 11: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:956:in `establish_connection' 10: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec' 9: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 8: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 7: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 6: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' 5: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi' 4: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 3: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi' 2: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require' 1: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/sqlite3_adapter.rb:12:in `<main>' /app/vendor/bundle/ruby/2.5.0/gems/bundler-2.0.1/lib/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem': Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? sqlite3 is not part of the bundle. Add it to your Gemfile. (LoadError)

ちなみにsqlite3はgemfileにすでに記入してあり、bundle install済みです。
どなたか解決策をお持ちの方はいらっしゃいませんでしょうか?
よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

ここの内容をもう一度確認してみてください。

投稿2019/05/28 03:16

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Shunpei0217

2019/05/31 14:57

ご回答ありがとうございます。 こちら試してみたのですが、以下のエラーが表示されてしまいました。。 An error occurred while installing pg (0.20.0), and Bundler cannot continue. Make sure that `gem install pg -v '0.20.0' --source 'https://rubygems.org/'` succeeds before bundling.
Shunpei0217

2019/05/31 14:57

gem install pg -v '0.20.0'を試してみても同じエラーでした。
退会済みユーザー

退会済みユーザー

2019/06/03 02:20 編集

すみませんが状況をもう少し具体的に説明してください。 > こちら試してみたのですが、... 何をどう試したんでしょうか? Gemfileを編集したのであれば、どのように変更したのか、 コマンドを実行したのであればどの順番で何を実行したのかなど。 > 以下のエラーが表示されてしまいました。。 何をしたらどこにエラーが表示されたんででしょうか? > gem install pg -v '0.20.0'を試してみても同じエラーでした。 エラーメッセージにある gem install pg -v '0.20.0' --source 'https://rubygems.org/&#039; を実行したということでしょうか? お使いのPCにPostgreSQLがインストールされてないのでGemのインストールに失敗しているのでは? そもそもRailsTutorialでは開発環境ではSQLite3を使ってるはずなのでそのエラーが発生すること自体がおかしい気もしますが。
退会済みユーザー

退会済みユーザー

2019/06/03 02:22

リンクを貼った箇所にはきちんとHerokuでのデータベースは何を使うのか、そうする理由はなんなのか、そのためにはどうするべきなのかが全て書いてあります。今回はそれを忠実に守ってない、理解できていないために起きているエラーです。もう一度確認してみてください。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問