4

I recently created a new project with Rails 4.2.0 and created a controller called Land for the landing page. So, I ran into this error upon visting http://localhost:3000/land/home:

Started GET "/" for ::1 at 2015-02-27 15:56:23 -0600
Processing by LandController#home as HTML
Rendered land/home.html.erb within layouts/application (0.0ms)
Completed 500 Internal Server Error in 5526ms

ActionView::Template::Error (TypeError: Object doesn't support this property or method
(in C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)):
3: <head>
4:   <title>Course</title>
5:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
6:   <%= javascript_include_tag 'application' %>
7:   <%= csrf_meta_tags %>
8: </head>
9: <body>
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__1279127835_98590860'


Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_source.erb (5.0ms)

Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_trace.html.erb (10.0ms)

Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_request_and_response.html.erb (1.0ms)

Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_web_console.html.erb (2.0ms)

Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/template_error.html.erb within rescues/layout (72.0ms)

Is there a way of getting rid of this error? Or is it a bug?

Rod Argumedo
  • 610
  • 11
  • 29

3 Answers3

16

I recently found another solution for this problem. gem 'coffee-script-source' in 1.9.0 has some issues with Rails on Windows. I reverted to the previous version using gem 'coffee-script-source', '1.8.0' in the Gemfile, this will resolve your problem.

Another way of solving this exception is installing Node.js onto your machine and the error should go away after installing & restarting rails server. Make sure that you add Node.js into your PATH before restarting the terminal(s) and rerun the server.

Rod Argumedo
  • 610
  • 11
  • 29
  • It works both ways. Although, I can put back turbolinks when `coffee-script-source` is down to 1.8.0. – Rod Argumedo Jun 11 '15 at 13:26
  • 1
    I had the same problem and this solution worked nicely. I'm also on a Windows machine. – Franco Jun 15 '15 at 23:24
  • 1
    This one solved mine too on Windows 10 computer, thanks a lot – Ashutosh Sep 19 '15 at 16:17
  • 1
    changing coffee version encountered another problem, but installing node.js solved the problem. Note, you need to add node to PATH after you install it and then start a new command line and restart the rails server – BillOverFlow Sep 02 '16 at 18:29
4

Ahh, it seems that you are missing

//= require turbolinks

in your application.js

See this on removing turbolinks (and obviously make sure it's all in place if you want it running).

jcuenod
  • 55,835
  • 14
  • 65
  • 102
4

I am running Windows 10, Ruby 2.1.7p400 and Rails 4.2.4. I could not get gem coffee-script-source '1.8.0' to install as gem insisted on version 1.9.1.1. I tried changing ExecJS to use UTF-8 encoding and running cscript without the //U switch as in this post without any luck as well.

I ended up placing nodejs.exe in the Ruby\bin folder and the issue was resolved.

Community
  • 1
  • 1