Skip to content

Instantly share code, notes, and snippets.

@raghubetina
Last active December 7, 2016 21:19
Show Gist options
  • Save raghubetina/e366faeeddf5a1f264714036d9ea023a to your computer and use it in GitHub Desktop.
Save raghubetina/e366faeeddf5a1f264714036d9ea023a to your computer and use it in GitHub Desktop.
First Draft Windows Fixes

Windows Fixes

Unfortunately with the recent releases of Rails 5 and Windows 10, and with RailsInstaller falling behind on updates, we need to take a few steps to fix some annoying incompatibilities once and for all.

First of all, the very first time you bundle for an app, remember to use the verbose command bundle install --without production instead.

SSL Errors

If you are experiencing one of the following issues:

  • When you try to bundle, you receive an error that looks something like

      SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
    

    Or you might get a message about "man in the middle" attacks.

  • When you try to access an API URL that begins with "https" (rather than "http"), it fails.

then you are most likely missing SSL certificates on your machine.

Permanent Fix

Described here. You need to download a file called cacert.pem into your C:\RailsInstaller folder, and then create a system environment variable through the Control Panel.

You should then be all set -- bundle and https API calls should work just fine.

ExecJS Errors

Permanent Fix

If you see an error message about ExecJS (TypeError: Object doesn't support this property or method), or if the server takes forever to respond to a page request, then you need to install Node.js. Download the .msi file, double-click it, and accept the defaults for the prompts.

After installation completes, restart your computer and try again. All should be well.

WDM Warning

Add gem "wdm" if Gem.win_platform? anywhere in the Gemfile and bundle to get rid of the WDM warnings.

Temporary Fixes (not recommended, but left for reference)

SSL

  • For the bundle issue, in your Gemfile, replace source 'https://rubygems.org' with source 'http://rubygems.org' (remove the s).

  • For the API issue, add a file in config/initializers called disable_ssl.rb with the following contents:

     require 'openssl'
     OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
    

    and then restart your server.

ExecJS

  • Add gem "coffee-script-source", "1.8.0" anywhere in the file
  • Then bundle update

If that still doesn't work, try the following in succession:

  • In app/assets/javascripts/application.js, delete the line //= require_tree .
  • In the Gemfile, uncomment gem "therubyracer", platforms: :ruby and then bundle.

Restart your server, and hopefully now you will be able to load a page successfully.


Some combination of the above steps have resolved the issues for everyone I have tested with. However, if you still are seeing the ExecJS issue, try the following:

  • In app/views/layouts/application.html.erb, change lines 18 & 19 from

     <%= stylesheet_link_tag    "application", :media => "all" %>
     <%= javascript_include_tag "application" %>
    

    to

     <%#= stylesheet_link_tag    "application", :media => "all" %>
     <%#= javascript_include_tag "application" %>
    

    (Insert a # between the % and =.)

    This is a short-term solution; I am working on something more permanent. In the meantime, be aware that these changes will break the Sign Out link, so you will have to clear cookies for localhost:3000 to sign out. Also, it will break the "Show Filters" button.

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