當我嘗試將我的Rails項目推送到Heroku時,出現錯誤消息。我使用Fontawesome,它在當地環境中工作正常,但不會推到Heroku。部署到heroku時導致Rails編譯器出現fontawesome錯誤
Running: rake assets:precompile I, [2016-03-22T05:59:25.096354 #366] INFO -- : Writing /tmp/build_3e31f1bb8b828cb787890706e9ec589b/public/assets/FontAwesome-0d34da07e5cbcb4ff087b397966a9f9ffb4d6ed7c7060568565203c02f3fee11.otf I, [2016-03-22T05:59:25.099701 #366] INFO -- : Writing /tmp/build_3e31f1bb8b828cb787890706e9ec589b/public/assets/fontawesome-webfont-e511891d3e01b0b27aed51a219ced5119e2c3d0460465af8242e9bff4cb61b77.eot
rake aborted! Sass::SyntaxError: Invalid CSS after "...orm-group::not(": expected pseudo_expr, was ":first-child)" (sass):9108
/tmp/build_3e31f1bb8b828cb787890706e9ec589b/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-3.0.4/lib/sprockets/rails/task.rb:67:in
block (2 levels) in define' Tasks: TOP => assets:precompile (See full trace by running task with --trace) ! ! Precompiling assets failed. ! ! Push rejected, failed to compile Ruby app
這裏是我的Gemfile:
source 'https://rubygems.org'
gem 'sprockets', '~> 3.0'
gem 'rails', '4.2.6'
gem 'pg', '~> 0.15'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
就是這樣。我嘗試運行rake資源:預編譯命令,當我嘗試推送到Heroku時,它給了我同樣的錯誤。訣竅是在預編譯資產之前先做rake資產:clean .-) –