Léo Coletta
Léo Coletta

Reputation: 1269

ActionView::Template::Error (SyntaxError: Unexpected token , in JSON at position 3)

I am trying to fetch a project to my local computer.

The project is using rails 5.1.4. I am using WSL (Linux on Windows), maybe it could be related.

When I start the server, no matter which page I go, the renderer stops on the first image_tag it encounters:

ActionView::Template::Error (SyntaxError: Unexpected token , in JSON at position 3):
     9:   <div class="row">
    10:     <div class="col-md-4">
    11:       <figure class="figure">
    12:         <%= image_tag("profile_test", class: "figure-img img-fluid rounded", width: "400", alt: "Anaïs Coletta Coaching")  %>
    13:         <figcaption class="figure-caption text-center">test <%= link_to "test", "https://www.test.com/fr/", {class: '', target: :_blank} %></figcaption>
    14:       </figure>
    15:       <div class="row">

app/views/pages/about.html.erb:12:in `_app_views_pages_about_html_erb__4371778765434195141_70186281261780'

Do you have any idea of what is causing the error? If not, do you know where I can get more information about the error?

Thanks

EDIT: Just noticed that the problem might be everywhere near assets include: it blocks also on stylesheet_link_tag and javascript_include_tag

Controller :

class PagesController < ApplicationController
  def home
    @articles = Article.order("created_at").last(3)
    @articles.reverse!
  end
end

Upvotes: 0

Views: 425

Answers (1)

dan-klasson
dan-klasson

Reputation: 14180

From the full stack you posted it seems to be related to autoprefixer-rails gem that is used by sass-rails which causes the JSON parsing error when it tries to pre-compile your sass.

If you have an old version of sass-rails try to update it

Upvotes: 2

Related Questions