可以让Rails 4在Windows上运行吗?
我正在研究Rails 4(使用候选版本)项目,现在需要在Windows机器上与某人协作。 我甚至无法得到一个基本的网页,但是:(即使使用Ruby 2.0安装sqlite3也很痛苦。现在,当我试图建立一个网页时(我刚刚创建了一个虚拟/家庭/索引控制器)和视图),我收到此错误:
Showing C:/Users/me/RubymineProjects/test_project/app/views/layouts/application.html.erb where line #6 raised: (in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/turbolinks-1.1.1/lib/assets/javascripts/turbolinks.js.coffee) Extracted source (around line #6): 3 4 TestProject 5 true %> 6 true %> 7 8 9
Rails 4还没有为Windows做好准备吗? 使用Ruby 2.0.0p195。
更新 :根据@szines请求,这是网页输出
http://localhost:3000/rails/info/properties: Ruby version 2.0.0 (x64-mingw32) RubyGems version 2.0.3 Rack version 1.5 Rails version 4.0.0.rc1 JavaScript Runtime JScript Active Record version 4.0.0.rc1 Action Pack version 4.0.0.rc1 Action Mailer version 4.0.0.rc1 Active Support version 4.0.0.rc1 Middleware ActionDispatch::Static Rack::Lock # Rack::Runtime Rack::MethodOverride ActionDispatch::RequestId Rails::Rack::Logger ActionDispatch::ShowExceptions ActionDispatch::DebugExceptions ActionDispatch::RemoteIp ActionDispatch::Reloader ActionDispatch::Callbacks ActiveRecord::Migration::CheckPending ActiveRecord::ConnectionAdapters::ConnectionManagement ActiveRecord::QueryCache ActionDispatch::Cookies ActionDispatch::Session::CookieStore ActionDispatch::Flash ActionDispatch::ParamsParser Rack::Head Rack::ConditionalGet Rack::ETag Warden::Manager Application root C:/Users/me/RubymineProjects/test_project Environment development Database adapter sqlite3 Database schema version 20130523073322
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
将此更改为:
<%= stylesheet_link_tag "defaults", media: "all", "data-turbolinks-track" => true %>
它应该工作。
如果有人可以为此提供解释,那将是很棒的。
更多信息:
用户#index(RoR)中的ExecJS :: RuntimeError
ExecJS并找不到JavaScript运行时
只需安装node.js,问题就会消失。
说明:如果您尝试预编译资产,您将获得以下跟踪:
(in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/turbolinks-1.3.0/lib/assets/javascripts/turbolinks.js.coffee) C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:142:in `exec_runtime' C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:28:in `block in exec' C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile' ...
如您所见,ExecJS存在问题。 ExecJS允许您从Ruby运行JavaScript代码,它需要在您的系统上安装一个JS解释器。 这是支持的口译员列表 。 通常,您可以使用仅仅是V8的therubyracer,但是在Windows下编译V8时会出现问题。 所以你可以选择另一个选项 – NodeJS。 当您安装NodeJS并将其添加到PATH时,ExecJS将自动使用它。
改变以下行
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
至
<%= javascript_include_tag "defaults", "data-turbolinks-track" => true %>
作品。
要么
你可以安装node.js.
让Turbolinks在Windows 8 x64上运行的实际解决方案发布在Windows上的ExecJS :: RuntimeError上,试图遵循rubytutorial ,选项3。
我已经面临这个问题一段时间了,它是在Windows上jquery和咖啡脚本在他们的最新更新中不起作用,最后我发现这个完美的方法完美无需下载节点或转义//需要树。 所以你需要的是配置runtimes.rb中的设置,它们存在于execjs中,就像这样 – 你会发现这部分只有很少的差异来修复它们,你会很高兴。
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
您可以观看此video以获取详细解决方案。 https://www.youtube.com/watch?v=N5i94L17KPo