Rails 3.1 comes with CoffeeScript. But it has weird error when I run first rails application. The error is ExecJS::RuntimeError and point to the code around importing CoffeeScript. After google this problem I found this solution that work for me.
Edit ExecJS’s runtimes.rb (should backup before edit)
Find the line start with JScript = ExternalRuntime.new(
On the line :command => “cscript //E:jscript //Nologo //U”,
– remove //U
On the line :encoding => ‘UTF-16LE’ # CScript with //U returns UTF-16LE
– change ‘UTF-16LE’ to ‘UTF-8’
It 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 )
Save it and restart rails server.