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

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

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby on Rails

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

Q&A

解決済

1回答

1080閲覧

Railsチュートリアル1章にてherokuにデプロイできない

boniri

総合スコア18

Ruby on Rails

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

0グッド

0クリップ

投稿2019/04/02 07:17

編集2019/04/02 09:24

前提・実現したいこと

Railsチュートリアル1章の演習です。herokuにデプロイしたいです。

Railsチュートリアル1章の最後でherokuにデプロイできないので、できるようにするにはどうすればいいのか知りたいです

■■な機能を実装中に以下のエラーメッセージが発生しました。

Ruby on Rails ```ここに言語を入力 ソースコード 怪しいメッセージが出されたところを記載します。

remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: Ruby,Node.js
remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.5.3
remote: -----> Installing dependencies using bundler 1.15.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.17.2). We suggest you upgrade to the latest version of Bundler by running gem install bundler.

remote: -----> Installing node-v10.14.1-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: Yarn executable was not detected in the system.
remote: Download Yarn at https://yarnpkg.com/en/docs/install
remote: I, [2019-04-02T06:34:46.302265 #1092] INFO -- : Writing /tmp/build_c9e78c29be5119b7644ba4a3951999d9/public/assets/application-7e084e44b9a13db0cda25bad2ac6fdbbfe31462ec93176e245cd0bcbc079f436.js
remote: I, [2019-04-02T06:34:46.302676 #1092] INFO -- : Writing /tmp/build_c9e78c29be5119b7644ba4a3951999d9/public/assets/application-7e084e44b9a13db0cda25bad2ac6fdbbfe31462ec93176e245cd0bcbc079f436.js.gz
remote: I, [2019-04-02T06:34:46.309277 #1092] INFO -- : Writing /tmp/build_c9e78c29be5119b7644ba4a3951999d9/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css
remote: I, [2019-04-02T06:34:46.309936 #1092] INFO -- : Writing /tmp/build_c9e78c29be5119b7644ba4a3951999d9/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css.gz
remote: Asset precompilation completed (2.77s)
remote: Cleaning assets
remote: Running: rake assets:clean
remote: -----> Detecting rails configuration
remote:
remote: ###### WARNING:
remote:
remote: You have not declared a Ruby version in your Gemfile.
remote: To set your Ruby version add this line to your Gemfile:
remote: ruby '2.5.3'
remote: # See https://devcenter.heroku.com/articles/ruby-versions for more information.
remote:
remote: ###### WARNING:
remote:
remote: Detecting rails configuration failed
remote: set HEROKU_DEBUG_RAILS_RUNNER=1 to debug
remote:
remote: ###### WARNING:
remote:
remote: No Procfile detected, using the default web server.
remote: We recommend explicitly declaring how to boot your server process via a Procfile.
remote: https://devcenter.heroku.com/articles/ruby-default-web-server
remote:
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> console, rake, web
remote:
remote: -----> Compressing...
remote: Done: 33.8M
remote: -----> Launching...
remote: Released v4
remote: https://cherry-pudding-18708.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/cherry-pudding-18708.git

  • [new branch] master -> master
### 問題に対して試したこと 『https://cherry-pudding-18708.herokuapp.com/』 にアクセスすると、 『Application error』 という文字が出たので、 『heroku logs --tail』コマンドを実行したところ、

2019-04-02T08:45:11.178789+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cherry-pudding-18708.herokuapp.com request_id=418c602d-6211-4552-9488-abbfd39fae16 fwd="115.69.237.151" dyno= connect= service= status=503 bytes= protocol=https
2019-04-02T08:45:11.634170+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cherry-pudding-18708.herokuapp.com request_id=7d395db1-345a-40ad-833c-8e770f0b8b7b fwd="115.69.237.151" dyno= connect= service= status=503 bytes= protocol=https
^C

とErrorの文字が出ました。 ここから先に進めない状態です。 ### 補足情報(FW/ツールのバージョンなど) 一応Gemfileの中身を記載しておきます。

source 'https://rubygems.org'

gem 'rails', '5.1.6'
gem 'puma', '3.9.1'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'jquery-rails', '4.3.1'
gem 'turbolinks', '5.0.1'
gem 'jbuilder', '2.7.0'

group :development, :test do
gem 'sqlite3', '1.3.13'
gem 'byebug', '9.0.6', platform: :mri
end

group :development do
gem 'web-console', '3.5.1'
gem 'listen', '3.1.5'
gem 'spring', '2.0.2'
gem 'spring-watcher-listen', '2.0.1'
end

group :production do
gem 'pg', '0.20.0'
end

Windows環境ではtzinfo-dataというgemを含める必要があります

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]こにより詳細な情報を記載してください。

database.ymlの中身も記載します。

SQLite version 3.x

gem install sqlite3

Ensure the SQLite 3 gem is defined in your Gemfile

gem 'sqlite3'

default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000

development:
<<: *default
database: db/development.sqlite3

Warning: The database defined as "test" will be erased and

re-generated from your development database when you run "rake".

Do not set this db to the same as development or production.

test:
<<: *default
database: db/test.sqlite3

production:
<<: *default
database: db/production.sqlite3

他にも載せるべき情報があれば教えていただけると幸いです。 チュートリアルを昨日始めたばかりなので、当たり前のことも分からない状態だと思います。 回答に対して変な質問をしたり、誤った言葉の使い方をしてしまったら、申し訳ありません。

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

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

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

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

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

nskydiving

2019/04/02 08:14

「Warning」は「Error」とは違い、問題なく動作する場合もあります。 コンソールログを見る限り「Error」は出ていないようですが、URLにアクセスしてサイトが表示されるかどうかは確認されていますでしょうか? また、「試したこと」に記載されている「同じようなメッセージが出力された人の解決方法を調べて真似してみた」だけでは何をやったのか分かりませんので、具体的な内容を記載してください。
boniri

2019/04/02 09:00

ご回答していただきありがとうございます。 『https://cherry-pudding-18708.herokuapp.com/』 にアクセスすると、 『Application error』 という文字が出たので、 『heroku logs --tail』コマンドを実行したところ、 2019-04-02T08:45:11.178789+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cherry-pudding-18708.herokuapp.com request_id=418c602d-6211-4552-9488-abbfd39fae16 fwd="115.69.237.151" dyno= connect= service= status=503 bytes= protocol=https 2019-04-02T08:45:11.634170+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cherry-pudding-18708.herokuapp.com request_id=7d395db1-345a-40ad-833c-8e770f0b8b7b fwd="115.69.237.151" dyno= connect= service= status=503 bytes= protocol=https とErrorの文字が出ました。 ここから先に進めない状態です。 『試したこと』に記載したことに関して忠告していただき、ありがとうございます。初めて投稿したので教えていただいたことを意識し、今後も利用させていただきたいと思います。
nskydiving

2019/04/02 09:04

補足情報ありがとうございます。 質問欄は修正できますので、そちらに追記をお願いします。 コメント欄は他の回答者が目を通さないことがありますので。
boniri

2019/04/02 09:16

かしこまりました。色々と丁寧に教えていただき、ありがとうございます。
nskydiving

2019/04/02 12:10

ステータスコードが「503」なので内部エラーです。 「heroku run rails console」で詳細ログを見てください。
boniri

2019/04/02 12:29

ご返信いただき、ありがとうございます。 『heroku run rails console』を行った結果を質問欄に載せようと思ったのですが、字数制限の問題で載せられなかったので、まずはこちらに載せます。 『heroku run rails console』を実行したところ、 $ heroku run rails console Running rails console on ⬢ cherry-pudding-18708... up, run.4775 (Free) Traceback (most recent call last): 66: from /app/bin/rails:9:in `<main>' 65: from /app/bin/rails:9:in `require' 64: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>' 63: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/command.rb:44:in `invoke' 62: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/command/base.rb:63:in `perform' 61: from /app/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' 60: from /app/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' 59: from /app/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' 58: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/console/console_command.rb:96:in `perform' 57: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/command/actions.rb:16:in `require_application_and_environment!' 56: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:329:in `require_environment!' 55: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:329:in `require' 54: from /app/config/environment.rb:5:in `<top (required)>' 53: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:353:in `initialize!' 52: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:58:in `run_initializers' 51: from /app/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each' 50: from /app/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each' 49: from /app/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component' 48: from /app/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `call' 47: from /app/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `each' 46: from /app/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component' 45: from /app/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from' 44: from /app/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' 43: from /app/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each' 42: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:59:in `block in run_initializers' 41: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `run' 40: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `instance_exec' 39: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/finisher.rb:67:in `block in <module:Finisher>' 38: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/finisher.rb:67:in `each' 37: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:354:in `eager_load!' 36: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:473:in `eager_load!' 35: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:473:in `each' 34: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:475:in `block in eager_load!' 33: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:475:in `each' 32: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!' 31: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:251:in `require_dependency' 30: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:335:in `depend_on' 29: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:357:in `require_or_load' 28: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:36:in `load_interlock' 27: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies/interlock.rb:11:in `loading' 26: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/concurrency/share_lock.rb:149:in `exclusive' 25: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies/interlock.rb:12:in `block in loading' 24: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:36:in `block in load_interlock' 23: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:379:in `block in require_or_load' 22: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require' 21: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency' 20: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require' 19: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require' 18: from /app/app/models/application_record.rb:1:in `<top (required)>' 17: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require' 16: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency' 15: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require' 14: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require' 13: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/base.rb:25:in `<top (required)>' 12: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/base.rb:326:in `<module:ActiveRecord>' 11: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks' 10: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:49:in `each' 9: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks' 8: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook' 7: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control' 6: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook' 5: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval' 4: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/railtie.rb:124:in `block (2 levels) in <class:Railtie>' 3: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/connection_handling.rb:58:in `establish_connection' 2: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:880:in `establish_connection' 1: from /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/connection_specification.rb:185:in `spec' /app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError) このような結果が出ました。 自分でもどこに問題があるのか探してみます。
boniri

2019/04/02 12:31

but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError) ここが重要な気がするのですが、合っているでしょうか? お時間があるときにご返信いただけると幸いです。
guest

回答1

0

ベストアンサー

but the gem is not loaded. Add gem 'sqlite3' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
ここが重要な気がするのですが、合っているでしょうか?

ここまで来れば自力で解決できると思います。

まずはエラーメッセージを読んでみましょう。
英語なので慣れていないと難しく感じるかもしれませんが、Google 翻訳を使っても良いので自分で思考することが大切です。

もしそれでも分からなかったら、Google で「(ログに出力されたエラーメッセージ) heroku」と検索してみてください。

投稿2019/04/02 12:58

nskydiving

総合スコア6500

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

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

boniri

2019/04/02 13:02

かしこまりました! 初心者相手に丁寧に教えていただき、誠にありがとうございます。 色々試してみて、それでも分からなかったら、またここで質問することにします!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問