2

私はnginxとパッセンジャーを使用して本番サーバーを実行していますが、これまでのところ、アセットをロードするまではうまくいきました. 最初に、このエラーが発生したことに気付きました (実際には、画像、js、および css をロードしなかったさまざまなアセットに対して多数のエラーが発生しました)。

I, [2013-09-09T02:14:03.566777 #16843]  INFO -- : Started GET "/stylesheets/style-responsive.css" for 137.XXX.XXX.228 at 2013-09-09 02:14:03 +0000
F, [2013-09-09T02:14:03.568269 #16843] FATAL -- : 
ActionController::RoutingError (No route matches [GET] "/stylesheets/style-responsive.css"):
  actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
  railties (4.0.0) lib/rails/engine.rb:511:in `call'
  railties (4.0.0) lib/rails/application.rb:97:in `call'
  passenger (4.0.16) lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
  passenger (4.0.16) lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
  passenger (4.0.16) lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
  passenger (4.0.16) lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'

スタック オーバーフローについて調査したところ、アセットをプリコンパイルする必要があることに気付きました。そうすると、プリコンパイル中に別のエラーが発生しました ( rake assets:precompile)。エラーは以下のとおりです。

(in /var/www/rails_apps/binaryhustle)
    rake aborted!
    /var/www/rails_apps/binaryhustle/app/assets/javascripts/application.js has already been required
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:392:in `circular_call_protection'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:373:in `build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `block in build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/caching.rb:58:in `cache_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:105:in `each'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:16:in `initialize'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `new'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `block in build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:395:in `circular_call_protection'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:373:in `build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `block in build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/caching.rb:58:in `cache_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:105:in `each'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:16:in `initialize'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `new'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `block in build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:395:in `circular_call_protection'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:373:in `build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `block in build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/caching.rb:58:in `cache_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/bundled_asset.rb:16:in `initialize'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:377:in `new'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:377:in `build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `block in build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/caching.rb:58:in `cache_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:257:in `benchmark'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:210:in `find_asset'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:119:in `block in compile'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `each'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `compile'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/rake/sprocketstask.rb:146:in `with_logger'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
    /home/ubuntu/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
    Tasks: TOP => assets:precompile
    (See full trace by running task with --trace)
    ubuntu@ip-172-31-20-120:/var/www/rails_apps/binaryhustle/app$ 

画像アセットはコンパイルされたように見えますが (私の public/assets フォルダーには次のようなファイルがたくさんあります: background-a24d0e733ba865da3290423b79329eb4.png、コンパイルされた画像も取得エラーを受け取ります (ただし、これは画像タグが適切に設定されていないことが原因である可能性があります)。以下のように、リンクが適切な形式であるため、css と js が機能しない理由はまだ説明されていません。

  <%= stylesheet_link_tag    "bootstrap.min", "style", "style-responsive", media: "all", "data-turbolinks-track" => true %>
  <%= javascript_include_tag "bootstrap.min", "data-turbolinks-track" => true %>
  <%= csrf_meta_tags %>

ここからどこへ行くかわからない!前もって感謝します。

4

0 に答える 0