Possible to get Rails 4 working on Windows?

前端 未结 5 971
借酒劲吻你
借酒劲吻你 2020-12-15 10:32

I\'m working on a Rails 4 (using the release candidate) project and now need to collaborate with someone on a Windows machine. I can\'t even get a basic webpage to come up,

相关标签:
5条回答
  • 2020-12-15 10:36

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

    Change this to :

    <%= stylesheet_link_tag "defaults", media: "all", "data-turbolinks-track" => true %>

    It should work.

    It will be great if someone can provide explanation for this.

    More info:

    ExecJS::RuntimeError in Users#index (RoR)

    ExecJS and could not find a JavaScript runtime

    0 讨论(0)
  • 2020-12-15 10:38

    changing following line

    <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
    

    to

    <%= javascript_include_tag "defaults", "data-turbolinks-track" => true %>
    

    works.

    OR

    you can install node.js

    0 讨论(0)
  • 2020-12-15 10:49

    I have been facing this problem for a while and it's that on windows jquery and coffee script are not functional in their latest update and finally i found this wonderful method that worked perfectly without the need to download node or escape //require tree. So all you need is configure the settings in your runtimes.rb which lives in execjs to be like this- you will find this part with few differences fix them and you'll be good to go.

    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
    

    You can watch this video for detailed solution. https://www.youtube.com/watch?v=N5i94L17KPo

    0 讨论(0)
  • 2020-12-15 10:54

    Just install node.js and the problem will gone.

    Explanation: If you'll try to precompile assets, you'll get the following trace:

    (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'
    ...
    

    As you can see, there is a problem with ExecJS. ExecJS lets you run JavaScript code from Ruby and it requires one of the JS interpreters to be installed on your system. Here's a list of supported interpreters. Usually, you can use therubyracer which is just V8 but there are problems with compiling V8 under the windows. So you can choose another option - NodeJS. ExecJS will use it automatically when you'll install NodeJS and add it to your PATH.

    0 讨论(0)
  • 2020-12-15 11:01

    The actual solution for getting Turbolinks to work on Windows 8 x64 is posted at ExecJS::RuntimeError on Windows trying to follow rubytutorial, option 3.

    0 讨论(0)
提交回复
热议问题