简体   繁体   中英

heroku / rails asset precompile gives SASS error

When I run in a production rails app:

heroku run rake assets:precompile --trace

I get the sass error below:

Sass::SyntaxError: Invalid CSS after "": expected keyframes selector (e.g. 10%), was "0"
  (in /app/app/assets/stylesheets/application.css)
(sass):10675

What does the last line mean? I assume it is telling me where to find the error, but what is 10675. I don't think it is the line of code. If it is not telling me where to find the code, then how do I figure out where to find the code.

Another thing that may be relevant: I have no problem precompiling in development.

I don't think the number is relevant to your error. I think it is a part of the backtrace, but it's still not relevant to your code. The error message gives you the hints for your specific code issues on lines 1 and 2.

If you're simply curious, you can find the Sass code relevant to this generated messages here on lines 66-68, and here on lines 48-55.

In other words, it's not an error code if that was what you were thinking or hoping.

As for your assets not compiling in production on Heroku, first make sure you have the gem required for Heroku to serve up assets:

group :production do
  gem 'rails_12factor'
end

And also, sometimes Heroku won't compile assets properly so you need to compile them locally with rake assets:precompile and then push to production again. It might be hanging on to a previous syntax error you used to have in your SCSS because the assets never re-compiled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM