Rails 4 - Heroku,无法推送,预编译资产失败

时间:2014-05-09 21:24:54

标签: ruby-on-rails heroku asset-pipeline

当我尝试将我的应用程序推送到Heroku时,它失败了,我收到了这个错误:

       Running: rake assets:precompile
   rake aborted!
   Sass::SyntaxError: Invalid CSS after "...AwesomeEotPath:": expected pseudoclass or pseudoelement, was "  'fontawesome-..."
   (in /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/app/assets/stylesheets/application.css)
   (sass):7150
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:1147:in `expected'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:1085:in `expected'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:1067:in `expr!'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:794:in `pseudo'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:672:in `simple_selector_sequence'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:640:in `_selector'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:619:in `selector'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:155:in `directive'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:553:in `block_child'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:546:in `block_contents'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:82:in `stylesheet'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/scss/parser.rb:27:in `parse'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/engine.rb:342:in `_to_tree'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/engine.rb:315:in `_render'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sass-3.2.19/lib/sass/engine.rb:262:in `render'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/sass_compressor.rb:24:in `evaluate'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:197:in `block in evaluate'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `each'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `evaluate'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/bundled_asset.rb:25:in `initialize'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `new'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `build_asset'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:257:in `benchmark'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:210:in `find_asset'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:119:in `block in compile'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `each'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `compile'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
   /tmp/build_dff3b836-b2e8-484b-a8ea-cdcf1febef51/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
   Tasks: TOP => assets:precompile
   (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.

应用程序将加载,但我的资产都没有加载。我的 application.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 top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require_tree .
 */

.table td.center, .table th.center {
   text-align: center;
}

我不太清楚这里发生了什么,或者如何解决这个问题。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

错误在于:

  

Sass :: SyntaxError:&#34之后的CSS无效; ... AwesomeEotPath:":预期   伪类或伪元素,是" ' fontawesome -..."

您的问题是您正在尝试加载SASS预处理器无法理解的方法。看起来有问题的方法是AwesomeEotPath,但我无法在不看到违规代码的情况下确定。

当您对资产进行预编译时,它基本上会将asset manifest(文件顶部的require部分)中的所有内容都包含在内,并将它们编译为application.css(或任何您的文件被叫)

您提到的文件结构如下:

/*
 *= require_self
 *= require_tree .
*/

我建议您的错误是由您的文件中包含的require_tree .个问题之一引起的。你应该发布任何其他CSS文件&您在应用中拥有的CSS依赖项。例如,如果您调用font-awesome-rails gem,则可能必须禁用此

如果您发布其他CSS& Gemfile,我们会更好地帮助你