If you are developing Ruby on Rails applications under Windows 8, you may have run into an error having to do with ExecJS. The exact error that occurs depends on the project, but it typically appears to occur in your application layout on the line that includes the application.js file. This error is almost always an ExecJS::RuntimeError. Luckily, there is an extremely easy fix for this issue. Inside your Ruby installation folder, navigate to the lib\ruby\gems\2.0.0\gems folder. Find a folder labelled execjs-x.x.x where x.x.x may vary depending on the version installed. Open up the lib\execjs folder. For example, on my machine the complete path would be C:\Ruby200\lib\ruby\gems\2.0.0\gems\execjs-2.0.2\lib\execjs. Open the file named runtimes.rb in a text editor.

Find the line that says:


:command     => "cscript //E:jscript //Nologo //U",

Change this line to:


:command     => "cscript //E:jscript //Nologo",

Next, find the line that says:


:encoding    => 'UTF-16LE' # CScript with //U returns UTF-16LE

Change this line to:


:encoding    => 'UTF-8' # CScript with //U returns UTF-16LE

The entire section should look like this:


JScript = ExternalRuntime.new(
  :name        => "JScript",
  :command     => "cscript //E:jscript //Nologo",
  :runner_path => ExecJS.root + "/support/jscript_runner.js",
  :encoding    => 'UTF-8' # CScript with //U returns UTF-16LE
)

Finally save and close the file, restart your rails server, and your Rails application should be functional again. Note: If you continue to have issues, go grab and install Node.js from The Node.js website. This is another way to fix things.