Skip to content
This repository was archived by the owner on Jun 10, 2018. It is now read-only.
This repository was archived by the owner on Jun 10, 2018. It is now read-only.

CSCRIPT.EXE doesn't work out-of-the-box on Windows 8 Consumer Preview #81

Closed

Description

@jediry

Getting Rails to work on Windows 8 CP has been challenging...the biggest hurdle has been that ExecJS isn't working. I finally tracked it down to something related to the character encoding: if I remove the //U flag to cscript.exe and change the output encoding to UTF-8 in runtimes.rb, it works again. Not sure whether this is a problem with Ruby on Win8, or with cscript.exe on Win8.

Activity

  1. floringogianu commented on May 8, 2012

    @floringogianu

    Hi, I'm on my first rail installation and unfortunately I made the mistake of using Windows 8 CP as my development machine. I would be very great-full if you could detail a bit on how to remove the //U flag to cscript.exe and change the output encoding..

    What I did at this point was to follow the discussion here: https://gist.github.com/rails/rails/issues/2880 and pull this: gem 'execjs', :git => 'git://github.com/kennyj/execjs.git', :branch => 'rails_issue_2880' by modifying my Gemfile and then bundle update..

    Thanks!

  2. jediry commented on May 20, 2012

    @jediry
    Author

    Sorry it took me so long to reply...I only have the change on my home PC, and I only remembered your message while at work. :-/

    The fix I made was to edit lib/execjs/runtimes.rb (under the execjs gem's path...c:\Ruby192\lib\ruby\gems\1.9.1\gems\execjs-1.3.0 on my machine) so that the JScript runtime is defined like so:

    JScript = ExternalRuntime.new(
      :name        => "JScript",
      :command     => "cscript //E:jscript //Nologo",
      :runner_path => ExecJS.root + "/support/jscript_runner.js",
      :encoding    => 'UTF-8'
    )
    

    If I recall correctly, I think I removed the //U parameter from the :command string, and changed the :encoding string to read "UTF-8" rather than "UTF-16LE".

  3. leighst commented on Oct 28, 2012

    @leighst

    Same problem. Worked for me. Time to move to Linux for dev.

  4. pottsk commented on Oct 30, 2012

    @pottsk

    Same issue, same resolution works on Windows 8 RTM. Rails 3.2.6, Ruby 1.9.3, execjs 1.4.0 .
    Thanks jediry, couldn't find this solution anywhere else. Everything else just said "install node.js", but I didn't want to install something else when the Windows Script Host is a supported runtime.

    Full execjs Runtimes.rb listing: https://github.com/sstephenson/execjs/blob/master/lib/execjs/runtimes.rb

    Working runtimes.rb :

    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
    )
    

    Non-working / Default runtimes.rb :

    JScript = ExternalRuntime.new(
        :name        => "JScript",
        :command     => "cscript //E:jscript //Nologo //U",
        :runner_path => ExecJS.root + "/support/jscript_runner.js",
        :encoding    => 'UTF-16LE' # CScript with //U returns UTF-16LE
    )
    

    This is the original error page I was seeing:

    ExecJS::RuntimeError in Say#hello 
    
    Showing C:/RailsDev/demo1/app/views/layouts/application.html.erb where line #6 raised: 
    
      (in C:/RailsDev/demo1/app/assets/javascripts/say.js.coffee)
    
    
    Extracted source (around line #6): 
    3: <head>
    4:   <title>Demo1</title>
    5:   <%= stylesheet_link_tag    "application", :media => "all" %>
    6:   <%= javascript_include_tag "application" %>
    7:   <%= csrf_meta_tags %>
    8: </head>
    9: <body>
    
    
    
    
    Rails.root: C:/RailsDev/demo1
    
    Application Trace | Framework Trace | Full Trace 
    app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___237228925_44687208'
    
  5. jmataya commented on Oct 30, 2012

    @jmataya

    I'm seeing the same thing and I also can get everything working with this fix on Windows 8 RTM, Rails 3.2.8, and Ruby 1.9.3.

    I've put together a branch that encompasses this fix: jmataya/execjs@72ddd8edeb1cd9fec2ed976f1f863fde5b551b74. Feel free to use it. I also tested against Windows 7 SP1 successfully.

    Once I figure out why a couple test cases are failing (see jmataya/execjs#1), I'll submit a pull request to bring this back in.

    To use this in your project Gemfile: gem 'execjs', :git => 'git://github.com/jmataya/execjs.git', :branch => 'issue-81'

  6. jeremychurch commented on Nov 5, 2012

    @jeremychurch

    Unfortunately that branch didn't work for me, but I did correct the issue by installing nodejs(from http://nodejs.org/) and restarting windows; in case that helps anyone else until the gem is fixed/updated.

  7. floringogianu commented on Feb 2, 2013

    @floringogianu

    Hi, I believe that 9 months ago when first dabbling with this I eventually made it work with jediry fix; that is using windows script host, but I then switched to linux.

    Today, reviewing this issue I installed nodejs and rebooted and it worked this way also. Hope this somehow helps.

    Too bad this isn't working out of the box yet with rails installer and execjs and with Windows Script Host.

  8. lvnilesh commented on Feb 19, 2013

    @lvnilesh

    On Win8 RTM - workaround provided by @pottsk works for me. Thanks.

  9. letrunghieu commented on Feb 20, 2013

    @letrunghieu

    Yep, the solution of @pottsk work for me (win8 pro 64bit - execjs 1.4.0). Thanks a lot.

  10. sunnyak247 commented on May 10, 2013

    @sunnyak247

    The solution provided by @pottsk worked for me. I am using a windows 8, 64 bit operating system. Thanks a lot.

  11. kurevin commented on May 28, 2013

    @kurevin

    Bump still not fixed....but looks like this repo is dead, no commits for over a year.

  12. jaeezzy commented on Jul 10, 2013

    @jaeezzy

    Hi guys I'm using Surface Pro and when I try to do the simple getting started guide from http://guides.rubyonrails.org/getting_started.html I get below error after I update config/routes.rb and try to load Hello Rails:

    screenshot 5

    I installed the package using railsinstaller-2.2.1 and then updated rails to version 4 using gem install. Any advise would be greatly appreciated as I haven't been able to run a simple Hello Rails since the last time I did rails in my uni 4-5 years ago :( ... thanks.

  13. prusswan commented on Jul 10, 2013

    @prusswan

    best advice: don't use Windows for RoR

    On Wed, Jul 10, 2013 at 8:23 PM, jaeezzy notifications@github.com wrote:

    Hi guys I'm using Surface Pro and when I try to do the simple getting
    started guide from http://guides.rubyonrails.org/getting_started.html I
    get below error after I update config/routes.rb and try to load Hello Rails:

    [image: screenshot 5]https://f.cloud.github.com/assets/323881/774487/f26d584c-e95a-11e2-8746-851e934c61e0.png

    I installed the package using railsinstaller-2.2.1 and then updated rails
    to version 4 using gem install. Any advise would be greatly appreciated as
    I haven't been able to run a simple Hello Rails since the last time I did
    rails in my uni 4-5 years ago :( ... thanks.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/81#issuecomment-20738254
    .

  14. jaeezzy commented on Jul 12, 2013

    @jaeezzy

    installed node.js and restarted computer and it ran the Hello rails fine..

  15. 15 remaining items

  16. KatieK2 commented on Oct 17, 2014

    @KatieK2

    For me, this happens on Win7 in the standard command prompt, as well as in Cmder.

    @belozi How to do I "go to the Gemfile"? I ran gem 'execjs', '1.2.4' from both C:\Ruby193\lib\ruby\gems\1.9.1\gems and C:\Ruby193\lib\ruby\gems\1.9.1\gems\execjs-2.2.2, but I got an error "Unknown command execjs" each time.

    Also, how do I ensure that a given package uses this version of ExecJS?

  17. belozi commented on Nov 11, 2014

    @belozi

    @KatieK2 It would be a part of your Rails app.

    1

    PS- sorry I took so long to respond, I didn't realize that this was here. :)

  18. javadKarbasian commented on Mar 23, 2015

    @javadKarbasian

    it doesn't work for me with version 2.4 execjs...

  19. zhongyi-tong commented on Mar 30, 2015

    @zhongyi-tong

    doesn't work for version 2.4 execjs +1

  20. rodrigoargumedo commented on Jun 21, 2015

    @rodrigoargumedo

    +1

  21. DSAMPAT commented on Sep 18, 2015

    @DSAMPAT

    For windows users, this may work. There is a problem with coffee-script-source >1.9.0 running on windows.

    It seems you have to add this to your gemfile:

    gem 'coffee-script-source', '1.8.0'

    then do

    bundle update coffee-script-source

  22. rodrigoargumedo commented on Sep 18, 2015

    @rodrigoargumedo

    Or you could do gem update --system for the latest version of RubyGems and reinstall execjs? I tried this and it worked like a charm.

  23. DSAMPAT commented on Sep 18, 2015

    @DSAMPAT

    @rodrigoargumedo I tried all the above options, and also mixed up a few combinations of them, till I found this http://stackoverflow.com/questions/28241981/rails-4-execjsprogramerror-in-pageswelcome and had done multiple system gem updates and bundle installs and updates.

    I reverted all my trials and downgraded my coffee-script-source and it works. Posting here to help out anyone else, who may have a similar issue.

    Updating files in vendor/cache

    • coffee-script-source-1.8.0.gem
      Removing outdated .gem files from vendor/cache
    • coffee-script-source-1.9.1.1.gem
      Bundle updated!
  24. rodrigoargumedo commented on Sep 18, 2015

    @rodrigoargumedo

    @DSAMPAT I did a fresh reinstall with 2.1.6 and ExecJS works fine as it should expect to behave with a single bundle install. Earlier versions gave the same exact error when ExecJS was incorrectly parsing the wrong thing. Reverting to 1.8.0 works if when working previous versions of Ruby.

  25. DSAMPAT commented on Sep 18, 2015

    @DSAMPAT

    @rodrigoargumedo Unless we compare bundle show we wont know for sure what other differences we may have as our apps may have other gems or dependencies that could use ExecJS as well.

    $ gem -v
    2.4.8

    $ gem update --system
    Latest version currently installed. Aborting.

    $ ruby -v
    ruby 2.2.3p173 (2015-08-18 revision 51636) [i386-mingw32]

    $ rails -v
    Rails 4.2.3

    Like I said, Posting here to help out anyone else, who may have a similar issue.

  26. codelearner777 commented on Nov 1, 2015

    @codelearner777

    Hello,

    I am having the same problem.
    I am new into programming so my needs and the web I build might not influence heavily with this problem. But still, I can not run this line properly.

    <%= link_to 'Delete', article_path(article), method: :delete, data: {confirm: 'Are you sure?'} %>

    so far, I just delete this line in application.html.erb so I can follow some tutorials.

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

    could some one help me?

    my setup is on
    Win 8.1
    image
    image

    editing jscript.rb does not solve the problem

    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

  27. RichIsOnRails commented on Nov 2, 2015

    @RichIsOnRails

    Just install node.js. also see
    https://richonrails.com/articles/ruby-2-2-on-windows for more info on
    Rails/Windows.
    On Nov 1, 2015 12:34 PM, "codelearner777" notifications@github.com wrote:

    Hello,

    I am having the same problem.
    I am new into programming so my needs and the web I build might not
    influence heavily with this problem. But still, I can not run this line
    properly.

    <%= link_to 'Delete', article_path(article), method: :delete, data:
    {confirm: 'Are you sure?'} %>

    so far, I just delete this line in application.html.erb so I can follow
    some tutorials.

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

    could some one help me?

    my setup is on
    Win 8.1
    [image: image]
    https://cloud.githubusercontent.com/assets/14092572/10870577/be3df64a-8100-11e5-9312-e75aa2585a95.png
    [image: image]
    https://cloud.githubusercontent.com/assets/14092572/10870580/d4b635ea-8100-11e5-839b-bf09e74d1e7f.png

    editing jscript.rb does not solve the problem

    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

    —
    Reply to this email directly or view it on GitHub
    #81 (comment).

  28. codelearner777 commented on Nov 3, 2015

    @codelearner777

    @RichIsOnRails , yupp...I installed node.JS and it works! Thanks!

  29. Bassmint123 commented on Sep 28, 2016

    @Bassmint123

    UPDATE: Since Windows 10 with Rails 5.0.0 and Ruby 2.3 has not been mentioned on this thread:

    1. On Win10 I got the same error message as jaeezzy above.
    2. I did the installation of node.js with no other changes and it runs fine.
  30. RichIsOnRails commented on Sep 28, 2016

    @RichIsOnRails

    @Bassmint123 yes, these days you basically have to install Node.js. There aren't really any easy alternatives unless you use WSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions