0

I'm new to the CoffeeScript and Rails generally, and every time I get an ExecJS::RuntimeError I have to manually go through each of the CoffeeScript files I've been working to find out what's wrong, since the Rails informs me that I've got, for instance, an unmatched OUTDENT and it's somewhere around line six, which is */app/views/layouts/application.html.erb, where all of my javascript is compiled. The problem is that the files keep grow in size and quantity and my debugging process becomes nightmarish. What can I do to find out in what exact *.coffee.js file an error has occurred?

  • 1
    Possible duplicate of [Coffeescript compilation error in ruby on rails](http://stackoverflow.com/questions/35955528/coffeescript-compilation-error-in-ruby-on-rails) – Eric Simonton Feb 18 '17 at 18:32

2 Answers2

0

In rails 4.2 when I make syntax error in any file I get more descriptive error message. I can't check it at the moment but as I remember in Rails 3 I had the same issue as you have. Solution? Change small number of files at once and run browser/specs.

djaszczurowski
  • 4,385
  • 1
  • 18
  • 28
0

(Copying my answer from another question)

One workaround is to compile your .coffee files outside rails to get a decent error message:

If you don't yet have it:

npm i coffee-script -g

Then in a parent directory of your .coffee files:

coffee --output deleteme --compile .

When you're done, delete the deleteme folder it created (which is only created if you fix all the errors). This should find the syntax error for you and tell you exactly where it is.

Community
  • 1
  • 1
Eric Simonton
  • 5,702
  • 2
  • 37
  • 54
  • Please don't add the same answer to multiple questions. Answer the best one and flag the rest as duplicates. See [Is it acceptable to add a duplicate answer to several questions?](http://meta.stackexchange.com/questions/104227/is-it-acceptable-to-add-a-duplica‌​te-answer-to-several-questions) – Petter Friberg Jan 24 '17 at 21:20
  • Got it. Flagged. (Or rather, flag suggested.) – Eric Simonton Feb 18 '17 at 18:32
  • Next step, delete this : ) – Petter Friberg Feb 18 '17 at 19:23