theodop
theodop

Reputation: 45

Local rails instance errors on turbolinks call

I have just set up a new Rails 4 instance and scaffolded out a user class.

Whenever I try and navigate to any of the scaffolded pages, I get an internal 500 error:

Started GET "/users" for 127.0.0.1 at 2013-08-11 18:57:28 +1000
Processing by UsersController#index as HTML
  User Load (0.0ms)  SELECT "users".* FROM "users"
  Rendered users/index.html.erb within layouts/application (2.0ms)
Completed 500 Internal Server Error in 1585ms

ActionView::Template::Error (
  (in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/turbolinks-1.3.0/lib/assets/javascripts/turbolinks.js.coffee)):
    3: <head>
    4:   <title>GlueFactory</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>
  app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___1232737741_41577300'

I have the turbolinks 1.3.0 gem installed. If I remove the line <%= javascript_include_tag "application", "data-turbolinks-track" => true %> from application.html.erb as indicated by the stack trace, it works OK.

I figure this must be an issue with my gem environment as I have uploaded this to Heroku and it runs OK from there with the turbolinks line included.

bundle show:

Upvotes: 3

Views: 19299

Answers (2)

binom
binom

Reputation: 156

I had the same problem on Ubuntu 14.04.

rake about

reported that node js was found.

which node

gave

/usr/sbin/node

which was actually a symlink to ax25-node.

Basically, rails was reporting that it found an executable with the name node on the path and was assuming that it was nodejs.

After I uninstalled the packages node and ax52-node and installed the nodejs package, the problem went away.

In windows, nodejs executable is named node. On a Linux system - at least on the version of ubuntu I have installed - the name of the executable is nodejs. I believe the reason for the error is that no suitable JavaScript interpreter could be found during runtime.

I hope it helps someone.

Upvotes: 3

RobD
RobD

Reputation: 76

I too have seen this error. It is an encoding issue with execjs. I found the solution on this thread (Here) I opted for the third option - much more satisfying!

Upvotes: 6

Related Questions