ExecJS::RuntimeError in rails 3.2.8 engine on Windows 8 - compatiblity issue #111

Closed
emclab opened this Issue Nov 27, 2012 · 8 comments

Comments

Projects
None yet
8 participants

emclab commented Nov 27, 2012

execjs 1.4.0 is not compatible with Windows 8 and it causes problem in rails 3.2.8 engine. Here is the error:

ExecJS::RuntimeError in Authentify/sessions#new
Showing C:/D/code/rails_proj/engines/authentify/app/views/layouts/sessions.html.erb where line #6 raised:

(in C:/D/code/rails_proj/engines/authentify/app/assets/javascripts/authentify/sessions.js.coffee)
Extracted source (around line #6):
3:
4: <title>Login</title>
5: <%= stylesheet_link_tag "authentify/application" %>
6: <%= javascript_include_tag "authentify/application" %>
7: <%= csrf_meta_tags %>
8:
9:

authentify is an rails 3.2.8 engine.

emclab commented Nov 27, 2012

Here is a fix googled online in runtimes.rb. The fix solves the runtime error. However rake assets:precompile still fails.

===fix googled online=====

Working runtimes.rb :

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
)

Non-working / Default runtimes.rb :

JScript = ExternalRuntime.new(
: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
)

akagr commented Dec 21, 2012

Install node.js
Works on windows and solved it for me.
(I had this issue on winidows 8 pro x64)

I'm not exactly sure where exactly this is happening, but I was troubleshooting using guard-coffeescript on windows. It appears that it's passing in ruby style path separators to cscript, instead of windows

cscript //E:jscript //Nologo //U C:/Users/rpeters.TBG/AppData/Local/Temp/execjs20121226-26172-rz92pd.js

Which cscript returns "Incorrect function"

I cursorily dug through it but was unable to find an appropriate solution.

ddbhatt commented Jun 29, 2013

@emclab Thanks for your solution.

I Just change UTF-16LE to UTF-16 keeping the //U option and it worked for me.

lathiat commented Nov 12, 2013

This is still an issue on Windows 8.1 / ExecJS 2.0.2.

UTF-16 with //U works, but it's not clear how this would effect other platforms.

@ricardodovalle ricardodovalle referenced this issue in rweng/jquery-datatables-rails Feb 1, 2014

Closed

Not working anymore #86

siniypin added a commit to siniypin/execjs that referenced this issue Apr 30, 2014

anggil commented Sep 2, 2014

@akagr : thanks for your suggestions.. i try to install Node.js installer, and so far no ExecJS::RuntimeError error appear..

may you can try this

betam4x commented Sep 17, 2014

It's broken on Windows Server 2012 as well.

Contributor

josh commented Oct 14, 2014

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 Oct 14, 2014

arturo-cobos referenced this issue in arturo-cobos/musicapp Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment