可以让Rails 4在Windows上运行吗?

at.*_*at. 11 ruby-on-rails ruby-2.0 ruby-on-rails-4

我正在研究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  <head>
4    <title>TestProject</title>
5    <%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
6    <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7    <%= csrf_meta_tags %>
8  </head>
9  <body>
Run Code Online (Sandbox Code Playgroud)

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
#<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x000000036b85c0>
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
Run Code Online (Sandbox Code Playgroud)

Yas*_*wal 21

<%= 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运行时

  • 嗨,这对我不起作用,但是如果我在它下面的行中更改"默认值"的"应用程序",它会在之后运行! (3认同)

Art*_*lin 8

只需安装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'
...
Run Code Online (Sandbox Code Playgroud)

如您所见,ExecJS存在问题.ExecJS允许您从Ruby运行JavaScript代码,它需要在您的系统上安装一个JS解释器.这是支持的口译员列表.通常,您可以使用仅仅是V8的therubyracer,但是在Windows下编译V8时会出现问题.所以你可以选择另一个选项 - NodeJS.当您安装NodeJS并将其添加到PATH时,ExecJS将自动使用它.


Sag*_*tri 7

改变以下行

<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
Run Code Online (Sandbox Code Playgroud)

<%= javascript_include_tag "defaults", "data-turbolinks-track" => true %>
Run Code Online (Sandbox Code Playgroud)

作品.

要么

你可以安装node.js.