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

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

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

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

Ruby on Rails 4

Ruby on Rails4はRubyによって書かれたオープンソースのウェブフレームワークです。 Ruby on Railsは「設定より規約」の原則に従っており、効率的に作業を行うために再開発を行う必要をなくしてくれます。

Q&A

解決済

3回答

15445閲覧

Rails の We're sorry, but something went wrong. のエラーについて

saki_program

総合スコア31

Ruby on Rails

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

Ruby on Rails 4

Ruby on Rails4はRubyによって書かれたオープンソースのウェブフレームワークです。 Ruby on Railsは「設定より規約」の原則に従っており、効率的に作業を行うために再開発を行う必要をなくしてくれます。

1グッド

0クリップ

投稿2015/06/22 10:53

さくらVPSにてRails & Passengerをproductionモードにて稼動させております。

We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.

というエラーが出力されます。

cat log/production.log にて中身を開くと

F, [2015-06-22T18:57:35.574169 #10294] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/javascripts/application.js"):
actionpack (4.0.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in call' actionpack (4.0.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in call'
railties (4.0.5) lib/rails/rack/logger.rb:38:in call_app' railties (4.0.5) lib/rails/rack/logger.rb:20:in block in call'
activesupport (4.0.5) lib/active_support/tagged_logging.rb:68:in block in tagged' activesupport (4.0.5) lib/active_support/tagged_logging.rb:26:in tagged'
activesupport (4.0.5) lib/active_support/tagged_logging.rb:68:in tagged' railties (4.0.5) lib/rails/rack/logger.rb:20:in call'
actionpack (4.0.5) lib/action_dispatch/middleware/request_id.rb:21:in call' rack (1.5.5) lib/rack/methodoverride.rb:21:in call'
rack (1.5.5) lib/rack/runtime.rb:17:in call' activesupport (4.0.5) lib/active_support/cache/strategy/local_cache.rb:83:in call'
rack (1.5.5) lib/rack/sendfile.rb:112:in call' railties (4.0.5) lib/rails/engine.rb:511:in call'
railties (4.0.5) lib/rails/application.rb:97:in call' passenger (5.0.10) lib/phusion_passenger/rack/thread_handler_extension.rb:94:in process_request'
passenger (5.0.10) lib/phusion_passenger/request_handler/thread_handler.rb:149:in accept_and_process_next_request' passenger (5.0.10) lib/phusion_passenger/request_handler/thread_handler.rb:110:in main_loop'
passenger (5.0.10) lib/phusion_passenger/request_handler.rb:414:in block (3 levels) in start_threads' passenger (5.0.10) lib/phusion_passenger/utils.rb:111:in block in create_thread_and_abort_on_exception'

とエラーログが出力されております。
どのように対処すればよいかわかりません。

退会済みユーザー👍を押しています

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

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

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

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

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

guest

回答3

0

自己解決

長きに渡りお付き合い頂いた、tink1e_さん、ありがとうございます。
あれから自分で色々試してみました。
原因は何だったのかは、結局わかりませんでしたが、解決策は、

  1. rails new コマンドでイチから再作成。
  2. プロジェクト配下で下記コマンドを順番に投入。

rake db:migrate RAILS_ENV=production
bundle exec rake assets:precompile RAILS_ENV=production
sudo service httpd restart

これで無事解決いたしました。

投稿2015/06/24 01:48

編集2015/06/24 01:49
saki_program

総合スコア31

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

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

tink1e_

2015/06/24 07:04

お力になれずすみません。。 よかったです!( ´ ▽ ` )ノ
guest

0

config/environments/production.rbを

lang

1config.serve_static_assets = false

していただくといかがでしたでしょうか?

追記:
すみません、コメントに書くべき内容を回答として投稿してしまいました。
削除ができないようなので、このままにしておきます。

投稿2015/06/22 14:35

編集2015/06/22 14:37
tink1e_

総合スコア31

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

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

saki_program

2015/06/22 14:44

お付き合い頂き、感謝します。 config.serve_static_assets = false に変更し、bundle install や sudo service httpd restart をしておりますが、 やはり解決できません。
saki_program

2015/06/23 15:26

tink1e_さん、長々とお付き合い頂き、とても感謝してます。 記載リンクページの方法でも試してみましたが、 自分のやり方が悪いせいなのかわかりませんが、未だ解決できていません。 とりあえず、Development環境で動かし、 また自分なりに調査してみます。
guest

0

いただいた内容のみですと、他に原因があることも考えられるのですが、
原因かもしれない事柄を1つ挙げます。

Rails にはアセットパイプライン(Assets Pipeline)というJavaScript や CSS、画像ファイルといった HTML に関係するファイル達(アセットファイル)を連結したり圧縮することで効率的にアクセスできるようにする仕組みが備わっています

このアセットパイプラインは、開発者が、railsに指示をして、事前に上記のアセットファイルを連結や圧縮をしておく必要がありますが、
**Development環境(モード)**では、開発のしやすさを考慮して、アセットパイプラインはオフになっています。
そのため、Development環境では、問題ないのですが、

Production環境(モード)では、デフォルトではオンになっているため、
もし、事前に上記のアセットファイルを連結や圧縮をしていないと、このようなエラーが現れることがあります。

ですので以下のようなコマンド(指示)を送ることで改善されるかもしれません。

lang

1bundle exec rake assets:precompile

「アセットパイプライン」で検索いただくとより詳しい情報が得られると思います。

投稿2015/06/22 12:19

tink1e_

総合スコア31

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

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

saki_program

2015/06/22 13:55

ご回答ありがとうございます。 bundle exec rake assets:precompile を発行してみましたが、 未だ問題は解決されません。 他に原因があることも考えられる とお答えいただきましたが、 他にどこかのエラーログを記載すればよろしいでしょうか?
tink1e_

2015/06/22 14:19

prodcution環境で実行する記述を含めても修正されませんか? bundle exec rake assets:precompile RAILS_ENV=production 解決されない場合は、 config/environments/production.rb を見せてください。
saki_program

2015/06/22 14:25

こちらは先に2点、true と修正しましたが 解決できませんでした。 config.serve_static_assets = true config.assets.compile = true 現状のproduction.rb を添付します。 HitApp::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both thread web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Enable Rack::Cache to put a simple HTTP cache in front of your application # Add `rack-cache` to your Gemfile before enabling this. # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. # config.action_dispatch.rack_cache = true # Disable Rails's static asset server (Apache or nginx will already do this). config.serve_static_assets = true # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = true # Generate digests for assets URLs. config.assets.digest = true # Version of your assets, change this if you want to expire all your assets. config.assets.version = '1.0' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # Set to :debug to see everything in the log. config.log_level = :info # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # Use a different cache store in production. # config.cache_store = :mem_cache_store # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = "http://assets.example.com" # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # config.assets.precompile += %w( search.js ) # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Disable automatic flushing of the log to improve performance. # config.autoflush_log = false # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new end
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.51%

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

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

質問する

関連した質問