[英]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. 当我使用
aws.push
部署我的rails 4.1应用程序时,它不提供我的任何静态资产。 Everything works but no css, javascript or images. 一切正常,但没有CSS,JavaScript或图像。
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. 更新1:这是我的application.css。 Its just the default one that comes with rails
它只是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"
我在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.
保罗·利德(Paul Leader)是对的,它与乘客无关。 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.' 问题是我的一个文件在另一个css文件中有一些额外的字符:
>>>>>>>>>>>>>>>>>>>External Changes
,这是因为我使用了两个与每个文本编辑器冲突的文本编辑器其他。'
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. 令人讨厌的是,我希望错误没有显示application.css,而是显示导致问题的实际文件。
AH!!!!!!!!! 啊!!!!!!!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.