"Rake Assets:Precompile" Gives Punc Error

Error when running `rake assets:precompile`

Take a look at this url this is almost same error.
https://github.com/resolve/refinerycms/issues/1186

Fix is here :
https://github.com/resolve/refinerycms/pull/1189

Summary: Your are missing 'comma' sign or 'semicolon' sign somewhere in your application.js file.
Log full trace here while running locally by following command:

bundle exec rake assets:precompile --trace

Can't Precompile Rails Assets Due to Uglifier Punc Error

It seems that you are using a feature of ES6 that is not supported by Uglifier: http://es6-features.org/#PropertyShorthand.

I think Uglifier's target is ES5 and won't accept anything but ES5 code. You can do a rapid fix by rewriting your code in ES5:

$.ajax({
url: "/products/per_amount",
data: {id: quantity, product: product},
dataType: "json",
type: "GET",

If you want to retain your syntax goodies look into using Babel to transpile your code into ES5.

Deploying to Heroku: ExecJS::RuntimeError: SyntaxError: Unexpected token

What ended up solving this problem for me (this time, at least), was to:

  1. precompile the assets locally (rake assets:precompile). This created two files on the local system - think they were gz files).
  2. Commit and push to Heroku. It worked after this.

Although, this explains nothing to me. I have never needed to precompile assets before. And, if it was necessary to do, why did the localhost always work without executing this command? And, Heroku always attempts to precompile the assets. Why did it succeed when I pushed, supposedly, pre-precompiled assets? Doesn't it redo the precompilation anyway?

So, for now, the problem is solved. I have no idea why.

heroku rake assets:precompile failed unknown compressor

Go to config/environments/production and remove or comment out the line:

config.assets.css_compressor = :purger


Related Topics



Leave a reply



Submit