Elastic Beanstalk Passenger-Standalone Rails不提供静态资产

时间:2014-07-04 20:41:19

标签: ruby-on-rails ruby postgresql passenger elastic-beanstalk

当我使用aws.push部署我的rails 4.1 app时,它不会为我的任何静态资产提供服务。一切正常,但没有CSS,JavaScript或图像。

当我尝试跑步时:

RAILS_ENV=production bundle exec rake assets:precompile

我收到此错误:

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

我的设置如下:

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

更新1: 这是我的application.css。它只是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
 */

我也忘记了一件大事。我在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'

1 个答案:

答案 0 :(得分:0)

哦,我的。这是我自己的错。 Paul Leader是对的,它与乘客没有任何关系。问题是我的一个文件在另一个css文件中有一些额外的字符:>>>>>>>>>>>>>>>>>>>External Changes,这是因为我使用了两个相互冲突的文本编辑器。'

糟糕的是,我希望错误没有说出application.css,而是向我显示导致问题的实际文件。

AH !!!!!!!!!