ExecJS coffee script not showing line numbers for compile errors (Rails asset pipeline)

前端 未结 2 1669
青春惊慌失措
青春惊慌失措 2021-02-05 17:49

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         


        
2条回答
  •  无人及你
    2021-02-05 18:07

    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.

提交回复
热议问题