ruby-on-rails – rake assets:precompile> Sass :: SyntaxError:“}”之后的CSS无效:期望“}”,是“”

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – rake assets:precompile> Sass :: SyntaxError:“}”之后的CSS无效:期望“}”,是“”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我之前在跑步:
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中的最后一行

谢谢

解决方法

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

猜你在找的Ruby相关文章