In one of my Rails apps, ExecJS is not showing line numbers for coffeescript compilation errors. My compile error message will look like this:
ExecJS::RuntimeErr
I figured it out -- it's due to the coffee-script-source
gem version. In the app that was giving line numbers, bundle show
gives coffee-script-source of 1.4.0, whereas the other app had a coffee-script-source version of 1.6.1.
I didn't notice this because the coffee-rails
gem doesn't tightly specify this dependency (in both my Gemfiles, I was using gem 'coffee-rails', '3.2'
). To get around this, just explicitly specify the coffee-script-source gem version:
gem 'coffee-rails', '3.2.2'
gem 'coffee-script-source', '1.5.0'
and bundle update coffee-script-source
.
Hopefully this helps anyone else who might run into this discrepancy.
This can also be fixed with this patch that embeds the line information in the error message for the ruby-coffee-script
gem.
If you're using source maps, this patch fixes the coffee-rails-source-maps
gem.