rails 在Win8 下出现ExecJS::RuntimeError
文章摘自http://ruby-china.org/topics/7523
execjs 现在已经能认到Windows自带的CScript了 所以windows下无需再装therubyracer和nodejs之类的JS Runtime
但是Win8下CScript 默认接受js编码是UTF-8, 而之前的CScript接受的是ASCII/GBK, 或者用//U参数后接受UTF-16,解决方法是
修改execjs gem 路径下 execjs\runtimes.rb
JScript = ExternalRuntime.new( :name => "JScript", :command => "cscript //E:jscript //Nologo //U", :runner_path => ExecJS.root + "/support/jscript_runner.js", :encoding => 'UTF-16LE')
JScript = ExternalRuntime.new( :name => "JScript", :command => "cscript //E:jscript //Nologo", :runner_path => ExecJS.root + "/support/jscript_runner.js", :encoding => 'UTF-8')