-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?

4
  • You need to install a JS runtime, like nodejs -- stackoverflow.com/questions/8362458/… Commented Jun 13, 2014 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. Commented Jun 13, 2014 at 21:14
  • Could you include the full error message? Commented Jun 13, 2014 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 %> Commented Jun 15, 2014 at 16:11

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.