Search code examples
ruby-on-railsruby-on-rails-4rspeccapybaraexecjs

ExecJS failing with CoffeeScript not defined


This has been killing me all day. I have a Rails app that I'm upgrading from 3.2 to 4.0.13 that works fine in development. In testing in Rails 4, I get

ExecJS::ProgramError: ReferenceError: CoffeScript is not defined

on a whole slew of integration tests. Nowhere am I explicitly calling or using ExecJS, it appears to be being called through coffee-script which is in turn being called through coffee-rails.

I don't even know what useful stuff I can give you to help. This even happens if I manually compile all my coffeescript to javascript, so I don't think it's my coffee that's making this happen.

Please feel free to ask for stuff and I'll give it to you.

Gems with versions that might be touching this:

rails 4.0.13
capybara 2.7.1
capybara-webkit 1.11.1
coffee-rails 4.2.1
coffee-script 2.4.1
execjs 2.7.0

Solution

  • The latest release of coffee-script-source is empty: https://github.com/jashkenas/coffeescript/issues/4403 due to a bad release

    Try and use 1.11.1

     gem 'coffee-script-source', '1.11.1'