rake assets:precompile> Sass :: SyntaxError:"}"之后的无效CSS"}",""

时间:2015-04-27 00:00:17

标签: ruby-on-rails sass

我在跑步:

RAILS_ENV=production rake assets:precompile --trace

然后我得到这个错误堆栈:


** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
Sass::SyntaxError: Invalid CSS after "}": expected "}", was ""
(sass):40696
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:1165:in `expected'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:1101:in `expected'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:1096:in `tok!'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:643:in `block'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:401:in `media_directive'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:219:in `special_directive'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:194:in `directive'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:660:in `block_child'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:653:in `block_contents'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:117:in `stylesheet'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/scss/parser.rb:42:in `parse'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/engine.rb:393:in `_to_tree'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sass-3.4.13/lib/sass/engine.rb:268:in `render'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/sass_compressor.rb:55:in `block in call'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/cache.rb:85:in `fetch'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/sass_compressor.rb:48:in `call'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/sass_compressor.rb:27:in `call'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/loader.rb:103:in `load_asset_by_uri'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/loader.rb:40:in `block in load'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/loader.rb:171:in `fetch_asset_from_dependency_cache'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/loader.rb:33:in `load'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/cached_environment.rb:47:in `yield'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/cached_environment.rb:47:in `load'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/base.rb:63:in `find_asset'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/base.rb:70:in `find_all_linked_assets'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/manifest.rb:138:in `block in find'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/path_utils.rb:223:in `block in stat_tree'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/path_utils.rb:207:in `block in stat_directory'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/path_utils.rb:204:in `each'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/path_utils.rb:204:in `stat_directory'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/path_utils.rb:222:in `stat_tree'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/legacy.rb:105:in `each'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/legacy.rb:104:in `each'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/manifest.rb:136:in `find'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/sprockets/manifest.rb:162:in `compile'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-3.0.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rake-10.4.2/bin/rake:33:in `'
/usr/local/rvm/gems/ruby-2.1.1@rails4/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.1.1@rails4/bin/rake:23:in `'
/usr/local/rvm/gems/ruby-2.1.1@rails4/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.1.1@rails4/bin/ruby_executable_hooks:15:in `'
Tasks: TOP => assets:precompile

我正在使用购买的模板,似乎这个错误是由成千上万的.css引起的。

如何追踪错误发生的确切位置?

堆栈中的(sass):40696表示已编译的.css

中的最后一行

谢谢

2 个答案:

答案 0 :(得分:9)

您可以通过运行sass -c app/assets/stylesheets来检查文件的语法。这可能会为您发现问题。

答案 1 :(得分:0)

我发现了{' freelancer' rails中的模板4.这是模板CSS文件的问题

使用以下代码,我得到了 Sass :: SyntaxError:" ... orm-group :: not之后的无效CSS(&#34 ;:期望的伪id_pr,是":first -child)" 错误。

.floating-label-form-group::not(:first-child) {
    padding-left: 14px;
    border-left: 1px solid #eee;
}

然而,在第一个孩子"周围放置双引号后,它解决了这个问题。

.floating-label-form-group::not(":first-child") {
    padding-left: 14px;
    border-left: 1px solid #eee;
}