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

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

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

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

Q&A

2回答

808閲覧

herokuにデプロイした時のエラーの原因がわかりません。

hannahmontana

総合スコア10

Heroku

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

0グッド

0クリップ

投稿2019/03/15 07:33

実現したいこと

Railsアプリをherokuにデプロイしても表示されません。

発生している問題・エラーメッセージ

以下のエラーが出ています。

The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved.

該当のソースコード

Gemfile

1# frozen_string_literal: true 2 3source 'https://rubygems.org' 4git_source(:github) { |repo| "https://github.com/#{repo}.git" } 5 6ruby '2.6.1' 7 8# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 9gem 'rails', '~> 5.2.2' 10 11# Use Puma as the app server 12gem 'puma', '~> 3.11' 13# Use SCSS for stylesheets 14gem 'sass-rails', '~> 5.0' 15gem 'bootstrap-sass', '~> 3.4.1' 16# Use Uglifier as compressor for JavaScript assets 17gem 'uglifier', '>= 1.3.0' 18# See https://github.com/rails/execjs#readme for more supported runtimes 19# gem 'mini_racer', platforms: :ruby 20 21# Use CoffeeScript for .coffee assets and views 22gem 'coffee-rails', '~> 4.2' 23# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 24gem 'turbolinks', '~> 5' 25# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 26gem 'jbuilder', '~> 2.5' 27# Use Redis adapter to run Action Cable in production 28# gem 'redis', '~> 4.0' 29# Use ActiveModel has_secure_password 30# gem 'bcrypt', '~> 3.1.7' 31 32# Use ActiveStorage variant 33# gem 'mini_magick', '~> 4.8' 34 35# Use Capistrano for deployment 36# gem 'capistrano-rails', group: :development 37 38# Reduces boot times through caching; required in config/boot.rb 39gem 'bootsnap', '>= 1.1.0', require: false 40 41# Devise 42gem 'devise' 43gem 'omniauth' 44gem 'omniauth-facebook' 45gem 'omniauth-twitter' 46 47#image 48gem 'carrierwave' 49gem 'rmagick' 50 51group :development, :test do 52 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 53 gem 'sqlite3', '1.3.13' 54 gem 'byebug', platforms: %i[mri mingw x64_mingw] 55 gem 'factory_bot_rails', '~> 4.0' 56 gem 'rspec-rails' 57end 58 59group :development do 60 # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 61 gem 'listen', '>= 3.0.5', '< 3.2' 62 gem 'web-console', '>= 3.3.0' 63 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 64 gem 'rubocop', '~> 0.65.0', require: false 65 gem 'spring' 66 gem 'spring-commands-rspec' 67 gem 'spring-watcher-listen', '~> 2.0.0' 68end 69 70group :test do 71 # Adds support for Capybara system testing and selenium driver 72 gem 'capybara', '>= 2.15' 73 gem 'selenium-webdriver' 74 # Easy installation and use of chromedriver to run system tests with Chrome 75 gem 'chromedriver-helper' 76end 77 78group :production do 79# Use postgresql as the database for Active Record 80gem 'pg', '>= 0.18', '< 2.0' 81end 82 83# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 84gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] 85

routes

1# frozen_string_literal: true 2 3Rails.application.routes.draw do 4 root "static_pages#index" 5 get 'static_pages/index' 6 get 'static_pages/about' 7 8 devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' } 9 devise_scope :user do 10 get '/users/sign_out' => 'devise/sessions#destroy' 11 end 12 13 resources :microposts, only: [:create, :destroy] 14end 15

試したこと

$heroku logs -t 2019-03-15T06:45:07.934611+00:00 heroku[web.1]: State changed from down to starting 2019-03-15T06:45:11.607963+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 51312 -e production` 2019-03-15T06:45:19.239779+00:00 heroku[web.1]: State changed from starting to up 2019-03-15T06:45:20.975849+00:00 heroku[router]: at=info method=GET path="/" host=hidden-caverns-25881.herokuapp.com request_id=96dd1ae5-d8e0-4427-ba20-e1e9861c0921 fwd="126.99.236.223" dyno=web.1 connect=0ms service=6ms status=404 bytes=1902 protocol=https 2019-03-15T06:45:20.970035+00:00 app[web.1]: => Booting Puma 2019-03-15T06:45:20.970082+00:00 app[web.1]: => Rails 5.2.2 application starting in production 2019-03-15T06:45:20.970084+00:00 app[web.1]: => Run `rails server -h` for more startup options 2019-03-15T06:45:20.970091+00:00 app[web.1]: Puma starting in single mode... 2019-03-15T06:45:20.970093+00:00 app[web.1]: * Version 3.12.0 (ruby 2.6.1-p33), codename: Llamas in Pajamas 2019-03-15T06:45:20.970107+00:00 app[web.1]: * Min threads: 5, max threads: 5 2019-03-15T06:45:20.970112+00:00 app[web.1]: * Environment: production 2019-03-15T06:45:20.970114+00:00 app[web.1]: * Listening on tcp://0.0.0.0:51312 2019-03-15T06:45:20.970115+00:00 app[web.1]: Use Ctrl-C to stop 2019-03-15T06:45:20.970122+00:00 app[web.1]: I, [2019-03-15T06:45:20.969881 #4] INFO -- : [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] Started GET "/" for 126.99.236.223 at 2019-03-15 06:45:20 +0000 2019-03-15T06:45:20.970927+00:00 app[web.1]: F, [2019-03-15T06:45:20.970796 #4] FATAL -- : [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] 2019-03-15T06:45:20.970932+00:00 app[web.1]: F, [2019-03-15T06:45:20.970880 #4] FATAL -- : [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] ActionController::RoutingError (No route matches [GET] "/"): 2019-03-15T06:45:20.971024+00:00 app[web.1]: F, [2019-03-15T06:45:20.970937 #4] FATAL -- : [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] 2019-03-15T06:45:20.971148+00:00 app[web.1]: F, [2019-03-15T06:45:20.971027 #4] FATAL -- : [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call' 2019-03-15T06:45:20.971181+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call' 2019-03-15T06:45:20.971189+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:38:in `call_app' 2019-03-15T06:45:20.971195+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:26:in `block in call' 2019-03-15T06:45:20.971197+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `block in tagged' 2019-03-15T06:45:20.971199+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:28:in `tagged' 2019-03-15T06:45:20.971200+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `tagged' 2019-03-15T06:45:20.971202+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:26:in `call' 2019-03-15T06:45:20.971203+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/remote_ip.rb:81:in `call' 2019-03-15T06:45:20.971204+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/request_id.rb:27:in `call' 2019-03-15T06:45:20.971206+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/method_override.rb:22:in `call' 2019-03-15T06:45:20.971207+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/runtime.rb:22:in`call' 2019-03-15T06:45:20.971215+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' 2019-03-15T06:45:20.971217+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/executor.rb:14:in `call' 2019-03-15T06:45:20.971218+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/static.rb:127:in `call' 2019-03-15T06:45:20.971219+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call' 2019-03-15T06:45:20.971221+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/railties-5.2.2/lib/rails/engine.rb:524:in `call' 2019-03-15T06:45:20.971223+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call' 2019-03-15T06:45:20.971224+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request' 2019-03-15T06:45:20.971225+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client' 2019-03-15T06:45:20.971227+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run' 2019-03-15T06:45:20.971229+00:00 app[web.1]: [96dd1ae5-d8e0-4427-ba20-e1e9861c0921] vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread' 2019-03-15T06:45:21.269136+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=hidden-caverns-25881.herokuapp.com request_id=e34a16a3-4c0f-4394-a730-1d7ecd1446f4 fwd="126.99.236.223" dyno=web.1 connect=0ms service=2ms status=304 bytes=48 protocol=https

何が原因かわからず、困っております。
どなたか教えていただければと思います。

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

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

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

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

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

guest

回答2

0

Herokuのログには以下のようなエラーメッセージが出ているのが確認できますでしょうか?

ActionController::RoutingError (No route matches [GET] "/")

rootのルーティングがないようです。
開発環境では問題なくTOPページが表示されているコードでしょうか?

それでしたら最新のものがコミットされていないと思います。

git add . git commit -m "commit message" git push heroku master

それぞれエラーなく実行されるかを確認しながら行ってください。
最後のデプロイコマンドでは、デプロイ時のログの最終行付近に deploy ..done と表示されていればデプロイ成功です。
マイグレーションの必要がある場合は行ってブラウザで確認してみてください。


開発環境でTOPページが表示されていないのでしたら、config/routes.rbファイルを開いてrootの設定を行ってください。

投稿2019/03/23 23:59

ykp_yk

総合スコア654

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

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

0

google翻訳
探しているページは存在しません。住所を誤って入力したか、ページが移動した可能性があります。

投稿2019/03/15 07:51

y_waiwai

総合スコア87784

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.47%

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

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

質問する

関連した質問