Rails 4.1.1问题记录

wes0 2014-05-31

运行环境 WIN8.1 64bit、Ruby 64bit

1、问题一 zonetime

启动报

gems/2.0.0/gems/tzinfo-1.2.0/lib/tzinfo/data_source.rb:182:in `rescue in create_default_data_source': No source of timezone data could be found. (TZInfo::DataSourceNotFound)
Please refer to http://tzinfo.github.io/datasourcenotfound for help resolving this error.
 from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.0/lib/tzinfo/data_source.rb:179:in `create_default_data_source'

在GemFile增加

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]

2、问题二

正常启动后,页面访问报

  <%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
  <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
  <%= csrf_meta_tags %>

js找不到

execjs跟Win8有点兼容性的问题。

execjs 现在默认使用Windows自带的CScript,但是Win8下CScript 默认接受js编码是UTF-8, 而之前的CScript接受的是ASCII/GBK, 或者用//U参数后接受UTF-8,解决方法是

修改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'
)

https://github.com/sstephenson/execjs/issues/111

这个上面有一些介绍。

相关推荐

AllenYoung / 0评论 2014-07-04
jizhename / 0评论 2013-09-03