1

I'm trying to get my assets pipeline set up according to the Heroku guide for Rails 4, but when I enter this at the console:

rake assets:precompile RAILS_ENV=production

I get this error:

rake aborted!
ExecJS::ProgramError: SyntaxError: Unexpected token: eof (undefined) (line: 46, col: 0, pos: 1394)

Error
    at new JS_Parse_Error (<eval>:3623:11948)
    at js_error (<eval>:3623:12167)
    at croak (<eval>:3623:22038)
    at token_error (<eval>:3623:22175)
    at unexpected (<eval>:3623:22263)
    at block_ (<eval>:3623:28063)
    at ctor.body (<eval>:3623:27686)
    at function_ (<eval>:3623:27782)
    at expr_atom (<eval>:3623:31068)
    at maybe_unary (<eval>:3624:1752)
new JS_Parse_Error ((execjs):3623:11948)
js_error ((execjs):3623:12167)
croak ((execjs):3623:22038)
token_error ((execjs):3623:22175)
unexpected ((execjs):3623:22263)
block_ ((execjs):3623:28063)
ctor.body ((execjs):3623:27686)
function_ ((execjs):3623:27782)
expr_atom ((execjs):3623:31068)
maybe_unary ((execjs):3624:1752)
V8::Error: SyntaxError: Unexpected token: eof (undefined)
at js_error (<eval>:3623:12167)
at croak (<eval>:3623:22038)
at token_error (<eval>:3623:22175)
at unexpected (<eval>:3623:22263)
at block_ (<eval>:3623:28063)
at ctor.body (<eval>:3623:27686)
at function_ (<eval>:3623:27782)
at expr_atom (<eval>:3623:31068)
at maybe_unary (<eval>:3624:1752)
at expr_ops (<eval>:3624:2523)
at maybe_conditional (<eval>:3624:2615)
at maybe_assign (<eval>:3624:3058)
at expression (<eval>:3624:3384)
at expr_list (<eval>:3623:31548)
at subscripts (<eval>:3624:1461)
at expr_atom (<eval>:3623:31132)
at maybe_unary (<eval>:3624:1752)
at expr_ops (<eval>:3624:2523)
at maybe_conditional (<eval>:3624:2615)
at maybe_assign (<eval>:3624:3058)
at expression (<eval>:3624:3384)
at expr_atom (<eval>:3623:30820)
at maybe_unary (<eval>:3624:1752)
at expr_ops (<eval>:3624:2523)
at maybe_conditional (<eval>:3624:2615)
at maybe_assign (<eval>:3624:3058)
at expression (<eval>:3624:3384)
at simple_statement (<eval>:3623:25942)
at <eval>:3623:23902
at <eval>:3623:22954
at <eval>:3624:3759
at parse (<eval>:3624:3999)
at parse (<eval>:3958:22)
at uglifier (<eval>:4003:13)
Tasks: TOP => assets:precompile

I have seen other posts on SO with similar errors like this and this, but in both of those cases, the error was nice enough to say which file the error was in. In my error, I don't see a reference to the actual file, so I'm stumped on where to go from here.

Looking back, when I started trying to fix this, it DID show a file (or something), but I can't make heads or tails of it (nor do I know why it stopped showing the location of the error...):

Error
    at new JS_Parse_Error (/private/var/folders/hz/1d1f64ln59b4_pl632lm6mpr0000gn/T/execjs20170121-47471-7jr3eejs:3623:11948)
    at js_error (/private/var/folders/hz/1d1f64ln59b4_pl632lm6mpr0000gn/T/execjs20170121-47471-7jr3eejs:3623:12167)
    at croak (/private/var/folders/hz/1d1f64ln59b4_pl632lm6mpr0000gn/T/execjs20170121-47471-7jr3eejs:3623:22038)
    at token_error (/private/var/folders/hz/1d1f64ln59b4_pl632lm6mpr0000gn/T/execjs20170121-47471-7jr3eejs:3623:22175)
    at unexpected (/private/var/folders/hz/1d1f64ln59b4_pl632lm6mpr0000gn/T/execjs20170121-47471-7jr3eejs:3623:22263)
    at block_ (/private/var/folders/hz/1d1f64ln59b4_pl632lm6mpr0000gn/T/execjs20170121-47471-7jr3eejs:3623:28063)
    at /private/var/folders/hz/1d1f64ln59b4_pl632lm6mpr0000gn/T/execjs20170121-47471-7jr3eejs:3623:27686
    at function_ (/private/var/folders/hz/1d1f64ln59b4_pl632lm6mpr0000gn/T/execjs20170121-47471-7jr3eejs:3623:27782)
    at expr_atom (/private/var/folders/hz/1d1f64ln59b4_pl632lm6mpr0000gn/T/execjs20170121-47471-7jr3eejs:3623:31068)
    at maybe_unary (/private/var/folders/hz/1d1f64ln59b4_pl632lm6mpr0000gn/T/execjs20170121-47471-7jr3eejs:3624:1752)
new JS_Parse_Error ((execjs):3623:11948)
js_error ((execjs):3623:12167)
croak ((execjs):3623:22038)
token_error ((execjs):3623:22175)
unexpected ((execjs):3623:22263)
block_ ((execjs):3623:28063)
(execjs):3623:27686
function_ ((execjs):3623:27782)
expr_atom ((execjs):3623:31068)
maybe_unary ((execjs):3624:1752)

I looked in the directory mentioned there and see no relevant files. I searched my whole system for "execjs20170121-47471-7jr3ee" and "execjs20170121-47471-7jr3eejs" with no luck.

From what I've read in the other posts, it looks like Uglifier is erroring out while parsing my Javascript, but again, I just don't know where to look to try to fix it.

Any ideas?

Community
  • 1
  • 1
Wemmick
  • 186
  • 2
  • 14

1 Answers1

-1

I had the same problem. You should see the error in your production logs since you ran the command with "RAILS_ENV=production". My production logs point to: /RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb in exec at line 39

This is the line:

 extract_result(@runtime.exec_runtime(filepath), filepath)

Though the line means nothing to me, it's evident that it's a "filepath" issue. It might be possible that some of your fonts are not properly defined. You should reference your font-urls with <%= asset_path "..." %> or sass-rails as explained here If it still doesn't work, try changing: config.assets.compile = false to config.assets.compile = true in production.rb as explained here

Community
  • 1
  • 1