Search code examples
javascriptruby-on-railswindowsspine.jseco

Eco Error Message: Unexpected 'INDENT' in Windows


I'm currently using spinejs and eco template system in rails project. It's work perfectly on my Mac, however there is a strange indent error when I deploy it on Windows. And the code is:

<div class="contacts">
    <% for contact_record in @unchecked_contact_records : %>
        <%= contact_record %><br>
    <% end %>
</div>

And the error message is:

ExecJS::ProgramError in Admin#dashboard

Showing C:/Users/rayshih.mama-PC/workspace/showwin_ror_1_5/app/views/layouts/application.html.erb where line #6 raised:

Error: Parse error on line 2: Unexpected 'INDENT'
  (in C:/Users/rayshih.mama-PC/workspace/showwin_ror_1_5/app/assets/javascripts/admin/views/dashboard/contacts.jst.eco)

Extracted source (around line #6):

3: <head>
4:   <title>Show Win Printing Service</title>
5:   <%= stylesheet_link_tag    "application" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8: </head>
9: <body>

I thought this is a problem only on block statement, but by this experiment:

<div class="contacts">
    <% if true: %>
        <%= "hello world" %><br>
    <% end %>
</div>

In this experiment, there is no error. So this is not a block statement bug. Seems like it only happen on for loop statement, but why?


Solution

  • This is a known issue: https://github.com/sstephenson/eco/issues/29

    I followed the instructions from one of the commenters and installed Node: http://nodejs.org/ Node is automatically added to your path so once you have checked node is in the path by typing "node" at the command prompt, restart your rails server and it should be fixed.