简体   繁体   中英

Elastic Beanstalk Passenger-Standalone Rails not serving static assets

When I use aws.push to deploy my rails 4.1 app, it doesn't serve any of my static assets. Everything works but no css, javascript or images.

When I try to run:

RAILS_ENV=production bundle exec rake assets:precompile

I get this error:

rake aborted!
Sass::SyntaxError: Invalid CSS after " */": expected "{", was ""
  (in /var/app/current/app/assets/stylesheets/application.css)
(sass):13506

My setup is the following:

64bit Amazon Linux 2014.03 v1.0.4 running Ruby 2.0 (Passenger Standalone)
Rails 4.1.1
Postgresql

Update 1: Here is my application.css. Its just the default one that comes with rails

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require_tree .
 *= require_self
 */

I Also forgot one huge thing as well. I get this error in production.log No route matches [GET] "/stylesheets/application.css"

F, [2014-07-04T20:25:02.034054 #29628] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/stylesheets/application.css"):
  actionpack (4.1.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (4.1.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.1.1) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.1.1) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.1.1) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.1.1) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.1.1) 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.1.1) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
  rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
  railties (4.1.1) lib/rails/engine.rb:514:in `call'
  railties (4.1.1) lib/rails/application.rb:144:in `call'
  passenger (4.0.45) lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
  passenger (4.0.45) lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
  passenger (4.0.45) lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
  passenger (4.0.45) lib/phusion_passenger/request_handler.rb:448:in `block (3 levels) in start_threads'

Oh my. It was my own fault. Paul Leader was right it had nothing to do with passenger. The problem was one of my files had some extra characters in another css file: >>>>>>>>>>>>>>>>>>>External Changes , which was because I used two text editors that conflicted with each other.'

What sucks is that I wish the error didn't say application.css and instead show me the actual file that was causing the problem.

AH!!!!!!!!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM