Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


CSCRIPT.EXE doesn't work out-of-the-box on Windows 8 Consumer Preview #81

jediry opened this Issue · 32 comments

Getting Rails to work on Windows 8 CP has been challenging...the biggest hurdle has been that ExecJS isn't working. I finally tracked it down to something related to the character encoding: if I remove the //U flag to cscript.exe and change the output encoding to UTF-8 in runtimes.rb, it works again. Not sure whether this is a problem with Ruby on Win8, or with cscript.exe on Win8.


Hi, I'm on my first rail installation and unfortunately I made the mistake of using Windows 8 CP as my development machine. I would be very great-full if you could detail a bit on how to remove the //U flag to cscript.exe and change the output encoding..

What I did at this point was to follow the discussion here: and pull this: gem 'execjs', :git => 'git://', :branch => 'rails_issue_2880' by modifying my Gemfile and then bundle update..



Sorry it took me so long to reply...I only have the change on my home PC, and I only remembered your message while at work. :-/

The fix I made was to edit lib/execjs/runtimes.rb (under the execjs gem's path...c:\Ruby192\lib\ruby\gems\1.9.1\gems\execjs-1.3.0 on my machine) so that the JScript runtime is defined like so:

JScript =
  :name        => "JScript",
  :command     => "cscript //E:jscript //Nologo",
  :runner_path => ExecJS.root + "/support/jscript_runner.js",
  :encoding    => 'UTF-8'

If I recall correctly, I think I removed the //U parameter from the :command string, and changed the :encoding string to read "UTF-8" rather than "UTF-16LE".


Same problem. Worked for me. Time to move to Linux for dev.


Same issue, same resolution works on Windows 8 RTM. Rails 3.2.6, Ruby 1.9.3, execjs 1.4.0 .
Thanks jediry, couldn't find this solution anywhere else. Everything else just said "install node.js", but I didn't want to install something else when the Windows Script Host is a supported runtime.

Full execjs Runtimes.rb listing:

Working runtimes.rb :

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

Non-working / Default runtimes.rb :

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

This is the original error page I was seeing:

ExecJS::RuntimeError in Say#hello 

Showing C:/RailsDev/demo1/app/views/layouts/application.html.erb where line #6 raised: 

  (in C:/RailsDev/demo1/app/assets/javascripts/

Extracted source (around line #6): 
3: <head>
4:   <title>Demo1</title>
5:   <%= stylesheet_link_tag    "application", :media => "all" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8: </head>
9: <body>

Rails.root: C:/RailsDev/demo1

Application Trace | Framework Trace | Full Trace 
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___237228925_44687208'

I'm seeing the same thing and I also can get everything working with this fix on Windows 8 RTM, Rails 3.2.8, and Ruby 1.9.3.

I've put together a branch that encompasses this fix: jmataya/execjs@72ddd8e. Feel free to use it. I also tested against Windows 7 SP1 successfully.

Once I figure out why a couple test cases are failing (see jmataya/execjs#1), I'll submit a pull request to bring this back in.

To use this in your project Gemfile: gem 'execjs', :git => 'git://', :branch => 'issue-81'


Unfortunately that branch didn't work for me, but I did correct the issue by installing nodejs(from and restarting windows; in case that helps anyone else until the gem is fixed/updated.

@hlb hlb referenced this issue in KKBOX/FireApp

Coffeescript not working #88


Hi, I believe that 9 months ago when first dabbling with this I eventually made it work with jediry fix; that is using windows script host, but I then switched to linux.

Today, reviewing this issue I installed nodejs and rebooted and it worked this way also. Hope this somehow helps.

Too bad this isn't working out of the box yet with rails installer and execjs and with Windows Script Host.


On Win8 RTM - workaround provided by @pottsk works for me. Thanks.


Yep, the solution of @pottsk work for me (win8 pro 64bit - execjs 1.4.0). Thanks a lot.


The solution provided by @pottsk worked for me. I am using a windows 8, 64 bit operating system. Thanks a lot.


Bump still not fixed....but looks like this repo is dead, no commits for over a year.


Hi guys I'm using Surface Pro and when I try to do the simple getting started guide from I get below error after I update config/routes.rb and try to load Hello Rails:

screenshot 5

I installed the package using railsinstaller-2.2.1 and then updated rails to version 4 using gem install. Any advise would be greatly appreciated as I haven't been able to run a simple Hello Rails since the last time I did rails in my uni 4-5 years ago :( ... thanks.


installed node.js and restarted computer and it ran the Hello rails fine..


Works like a charm for me, thanks a mil!


Works for me too. Windows 8 Pro.


@pottsk's solution worked for me, too. Hugely appreciated.

FWIW, this issue has surfaced in a few posts on StackOverflow. Mentioned the workaround, but will be great to get the solution committed!


Rather than closing this issue, don't you think you should make the change listed above to runtimes.rb for windows 8 users?


@pottsk's fix worked here as well. Thanks!

@R-Gaurav this link worked fine for me ( Windows 8)


And asking Windows Rails users to install node.js just to be able to write Rails apps is overkill.


Win 7 SP1 + Ruby 2.0.0 + Rails 4.0 the workaround doesn't work for me..... try to install node.js


Thanks to @jediry! This fix / workaround worked for me on Windows 8.1 Pro as well.



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


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

Change the ExecJS version to 1.2.4

  1. Go to the Gemfile
  2. Type "gem 'execjs', '1.2.4'"
  3. Go to the command line in the application: bundle install
  4. Prosper

Thanks belozi. That worked!


Thanks Belozi, that solution worked for me , when the most poular one did not . Much obliged :) !


Installed execjs 1.2.4. It works now, but it does not accept unicode characters in source files. I don't know if that's on purpose (i.e. that I should not have unicode chars in js sources anyway)... but it definitely breaks compatibility with other js platforms.

Converted to use escaped chars (via and it works for now. Thanks.


Finally got it figured out! Its a Powershell feature/bug.

Anyway, as of 35c542a, it always writes the output to a tempfile which bypasses all the shell encoding stuff.

@josh josh closed this

For me, this happens on Win7 in the standard command prompt, as well as in Cmder.

@belozi How to do I "go to the Gemfile"? I ran gem 'execjs', '1.2.4' from both C:\Ruby193\lib\ruby\gems\1.9.1\gems and C:\Ruby193\lib\ruby\gems\1.9.1\gems\execjs-2.2.2, but I got an error "Unknown command execjs" each time.

Also, how do I ensure that a given package uses this version of ExecJS?


@KatieK2 It would be a part of your Rails app.


PS- sorry I took so long to respond, I didn't realize that this was here. :)


it doesn't work for me with version 2.4 execjs...


doesn't work for version 2.4 execjs +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.