0

As I am pushing to heroku I encountered this error and I have no idea what it means. It runs fine locally and there are no errors.

remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        ExecJS::RuntimeError: SyntaxError: Unexpected token: operator (>) (line: 3766, col: 54, pos: 255542)
remote:        Error
remote:        at new JS_Parse_Error (/tmp/execjs20160926-272-1dcsr5bjs:3623:11948)
remote:        at js_error (/tmp/execjs20160926-272-1dcsr5bjs:3623:12167)
remote:        at croak (/tmp/execjs20160926-272-1dcsr5bjs:3623:22038)
remote:        at token_error (/tmp/execjs20160926-272-1dcsr5bjs:3623:22175)
remote:        at unexpected (/tmp/execjs20160926-272-1dcsr5bjs:3623:22263)
remote:        at expr_atom (/tmp/execjs20160926-272-1dcsr5bjs:3623:31244)
remote:        at maybe_unary (/tmp/execjs20160926-272-1dcsr5bjs:3624:1752)
remote:        at expr_ops (/tmp/execjs20160926-272-1dcsr5bjs:3624:2523)
remote:        at maybe_conditional (/tmp/execjs20160926-272-1dcsr5bjs:3624:2615)
remote:        at maybe_assign (/tmp/execjs20160926-272-1dcsr5bjs:3624:3058)
remote:        at maybe_assign (/tmp/execjs20160926-272-1dcsr5bjs:3624:3232)
remote:        at expression (/tmp/execjs20160926-272-1dcsr5bjs:3624:3384)
remote:        at expr_list (/tmp/execjs20160926-272-1dcsr5bjs:3623:31548)
remote:        at subscripts (/tmp/execjs20160926-272-1dcsr5bjs:3624:1461)
remote:        new JS_Parse_Error ((execjs):3623:11948)
remote:        js_error ((execjs):3623:12167)
remote:        croak ((execjs):3623:22038)
remote:        token_error ((execjs):3623:22175)
remote:        unexpected ((execjs):3623:22263)
remote:        expr_atom ((execjs):3623:31244)
remote:        maybe_unary ((execjs):3624:1752)
remote:        expr_ops ((execjs):3624:2523)
remote:        maybe_conditional ((execjs):3624:2615)
remote:        maybe_assign ((execjs):3624:3058)
remote:        maybe_assign ((execjs):3624:3232)
remote:        expression ((execjs):3624:3384)
remote:        expr_list ((execjs):3623:31548)
remote:        subscripts ((execjs):3624:1461)
remote:        /tmp/build_49f5fc95a42160b27bfb23a9d4154294/vendor/bundle/ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'

My application.js file is as follows.

//= require jquery_ujs
//= require bootstrap-slider
//= require turbolinks
//= require RGraph.common.core
//= require RGraph.common.dynamic
//= require RGraph.common.tooltips
//= require RGraph.hprogress
//= require_tree .

I tried to look up some solutions but most of the problems involved an unexpected token operation (<) and not (>). I don't know what code to copy into here because I have no clue where the problem lies, but I will copy and paste my code when needed or asked.

user6500179
  • 149
  • 1
  • 2
  • 12

1 Answers1

0

The simplest fix would be to turn of assets compilation on heroku and commit and push the compiled assets. However its not a solution I would prefer as it adds a lot of noise to the git history and tedious and error prone step to deployment. But if you are on a time crunch this could be the way to go.

Its hard to actually debug what the the exact cause could be. Somewhere in the process of concatenating and minifying your assets the pipeline is creating a bad file.

To be able to debug this without messing with the master branch of your repository or affecting the existing app in production you should create a topical branch and a separate "staging" app on heroku.

1. create a topical branch in git

git checkout -b fix-assets-issue

2. setup the Heroku staging app

Create the new app via the web GUI or the CLI:

heroku create myapp-staging --remote staging 

3. Push your topical branch to the staging master branch

git push staging fix-assets-issue:master

This will probably fail exactly like you previous attempts.

4. Narrow down the problem set.

Try "commenting out" all the directives from the sprockets manifesto. (sprockets will only process lines starting //=)

//#= require jquery_ujs
//#= require bootstrap-slider
//#= require turbolinks
//#= require RGraph.common.core
//#= require RGraph.common.dynamic
//#= require RGraph.common.tooltips
//#= require RGraph.hprogress
//#= require_tree .

Commit and push. (see #3)

Re-add them one by one until you find the cause of the error. Commit and push. (see #3)

Once you find the source of the problem check if the dependency has issues on github or that you are using an up-to-date version.

max
  • 96,212
  • 14
  • 104
  • 165
  • This answer does not actually contain a fix for the underlying issue but should help you narrow down the cause. – max Sep 27 '16 at 09:59