2014-07-04 63 views
0

當我使用aws.push部署我的rails 4.1應用程序時,它不提供我的任何靜態資產。一切正常,但沒有CSS,JavaScript或圖像。Elastic Beanstalk沒有提供靜態資產的乘客獨立導軌

當我嘗試運行:

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: 這裏是我的應用程序的CSS。它只是默認的一個與軌道

/* 
* 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

與Passenger或EB無關,這都歸咎於您的CSS資產無法編譯。 從內存中,我認爲EB會運行rake資源:部署新版本時的預編譯任務,如果這樣做不起作用,那麼將不會有資產提供服務。 您看到的錯誤表明您的application.css文件中存在錯誤,您是否可以發佈內容以便我們可以看到可能出錯的內容? –

+0

是的對不起,我添加了CSS和production.log錯誤。 –

回答

0

噢我的。這是我自己的錯。保羅·利德說得對,它與乘客無關。問題是我的一個文件在另一個css文件中有一些額外的字符:>>>>>>>>>>>>>>>>>>>External Changes,這是因爲我使用了兩個相互衝突的文本編輯器。

真是太糟糕了,我希望錯誤沒有說application.css,而是讓我看看導致問題的實際文件。

AH !!!!!!!!!

相關問題