-1

For some reason rails is not liking the following code and I am not sure why. It seems to be throwing an Uncaught Error: ExecJS::RuntimeError.

The file that it is complaining about is my schedules.js.coffee and the only code I have in file is the following:

# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

jQuery ->
  $(document).on "page:change", ->
    $("#sched_date").datepicker
      changeMonth: true
      changeYear: true
      dateFormat: "yy-mm-dd"
      duration: "slow"
  return

What is wrong with this code?

DaveInFL
  • 162
  • 2
  • 9
  • You need to install a JS runtime, like nodejs -- http://stackoverflow.com/questions/8362458/error-when-running-rails-app-execjsruntimeerror – Damien Roche Jun 13 '14 at 20:00
  • But I have other coffee script files with very, very similar code and those seem to be fine. I also have gem 'jquery-rails' in my gemfile. – DaveInFL Jun 13 '14 at 21:14
  • Could you include the full error message? – Damien Roche Jun 13 '14 at 23:12
  • Here is what I am seeing. ExecJS::RuntimeError in StaticPages#home and then it points to the following line in application.html.erb file, which has not been changed in quite a while: <%= javascript_include_tag "application", "data-turbolinks-track" => true %> – DaveInFL Jun 15 '14 at 16:11

1 Answers1

0

I found out what was causing this issue. Seems that execjs was updated and there is an issue with the runtimes.rb file and windows 8 64bit. Once I edited the runtimes.rb file (had done this a while back when I initially installed rails) things are back to normal.

So, my only other question is, what gem updates execjs? Is it jquery-rails? If so I will look at specifying the exact version in my gemfile to stop this happening again.

The following link was helpful in fixing this issue:

Execjs runtimes.rb fix

Community
  • 1
  • 1
DaveInFL
  • 162
  • 2
  • 9