簡體   English   中英

資產預編譯錯誤,無法在乘客中運行生產模式,但在Rails 3中可以使用webrick

[英]Assets precompile error and can not run production mode in passenger but webrick is ok in Rails 3

當我想將應用程序從開發切換到生產時。

我可以通過(rails server或rails server -e production)運行我的應用程序

兩者都很好!

但是,當我嘗試在3.x + nginx乘客中運行時,它顯示了以下錯誤。

Started GET "/" for 127.0.0.1 at 2013-10-10 08:24:33 +0800
Processing by UrltestsController#index as HTML
  Rendered urltests/index.html.haml within layouts/application (6.4ms)
Completed 500 Internal Server Error in 4919ms

ActionView::Template::Error (Invalid CSS after "background-color: ": expected expression (e.g. 1px, bold), was "#white;"
  (in /Volumes/COMMON/Dropbox/rails/zeus/app/assets/stylesheets/application.css)):
    3:     %head
    4:         %meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=UTF-8'}
    5:         %title DQA Automation Tools Web Server Version
    6:         = stylesheet_link_tag 'application', :media=>'all'
    7:         = javascript_include_tag 'jquery','application'
    8:         = csrf_meta_tags
    9:         = tinymce_assets
  app/views/layouts/application.html.haml:6:in `_app_views_layouts_application_html_haml__2974668664975918893_70349045950040'
  app/controllers/urltests_controller.rb:11:in `index'

所以我試着跑

RAILS_ENV=production bundle exec rake assets:precompile

但是還是失敗了

** Execute assets:precompile:primary
rake aborted!
Invalid CSS after "background-color: ": expected expression (e.g. 1px, bold), was "#white;"
  (in /Volumes/COMMON/Dropbox/rails/zeus/app/assets/stylesheets/application.css)
(sass):1738
/Volumes/COMMON/Dropbox/rails/zeus/vendor/bundle/ruby/1.9.1/gems/sass-3.2.10/lib/sass/scss/parser.rb:1147:in `expected'

/Volumes/COMMON/Dropbox/rails/zeus/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load'
/Volumes/COMMON/Dropbox/rails/zeus/vendor/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile

grep我的css文件

stylesheets/custom.css.scss
83:    background-color:#333333;

stylesheets/menu.css
7:background-color: #2f3c4c; }
11:background-color: #white;
21:background-color: white; }
38:background-color: gray;
45:background-color: #red; }
47:background-color: #2f3c4c;
57:background-color: gray;
72:background-color: gray;
85:background-color: #cce0cc; }
87:background-color: white;
91:  background-color: red;

stylesheets/scaffolds.css.scss
2:  background-color: #fff;
16:  background-color: #eee;
28:    background-color: #000;
44:  background-color: red;
54:  background-color: #f0f0f0;
62:    background-color: #c00;

background-color:#white; 應該是background-color:white; 如果要指定十六進制顏色,則只能使用# 請參閱CSS中的第11行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM