# Unexpected syntax error on previous stable project

**URL:** <https://discourse.gohugo.io/t/unexpected-syntax-error-on-previous-stable-project/35472>\
**Category:** support\
**Created:** [November 6, 2021, 11:07am UTC](https://discourse.gohugo.io/t/unexpected-syntax-error-on-previous-stable-project/35472 "2021-11-06T11:07:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![brunoamaral](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brunoamaral/32/21144_2.png) [@brunoamaral](https://discourse.gohugo.io/u/brunoamaral)\
**Post date:** [November 6, 2021, 11:07am UTC](https://discourse.gohugo.io/t/unexpected-syntax-error-on-previous-stable-project/35472/1 "2021-11-06T11:07:11Z")

</div>

I’m running version 89.1 and fixing the tweet shortcode format. It recently started giving this error:

```auto
ERROR 2021/11/06 11:01:28 unexpected : in var statement on line 340 and column 24
    8: var end: new Date(dt);
                      ^
ERROR 2021/11/06 11:01:28 expected ) instead of EOF in arguments on line 361 and column 77
    1: document.getElementById(
                               ^
Error: Error building site: failed to render pages: expected ) instead of EOF in arguments on line 298 and column 100
    1: document.getElementById(
                               ^
Total in 82503 ms

```

I’m still trying to track down where the offending code might be, but the first bit looks like core hugo.

---

<div class="post-metadata">

**Author:** ![chrillek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/chrillek/32/19797_2.png) [@chrillek](https://discourse.gohugo.io/u/chrillek)\
**Post date:** [November 6, 2021, 11:53am UTC](https://discourse.gohugo.io/t/unexpected-syntax-error-on-previous-stable-project/35472/2 "2021-11-06T11:53:20Z")

</div>

> [@brunoamaral](#):
>
> where the offending code might be

Obviously somewhere in your JavaScript. I guess that the “:” in the first error should be a ";2 (or, given the following statement, rather a “=”, because otherwise `new Date(dt)` would not make much sense.

---

<div class="post-metadata">

**Author:** ![brunoamaral](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brunoamaral/32/21144_2.png) [@brunoamaral](https://discourse.gohugo.io/u/brunoamaral)\
**Post date:** [November 6, 2021, 3:22pm UTC](https://discourse.gohugo.io/t/unexpected-syntax-error-on-previous-stable-project/35472/3 "2021-11-06T15:22:26Z")

</div>

you’re right it was a piece of Javascript but it’s strange that Hugo would evaluate something that is already surrounded by `<script>`.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [November 6, 2021, 3:37pm UTC](https://discourse.gohugo.io/t/unexpected-syntax-error-on-previous-stable-project/35472/4 "2021-11-06T15:37:10Z")

</div>

Do you have --minify enabled?

---

<div class="post-metadata">

**Author:** ![brunoamaral](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brunoamaral/32/21144_2.png) [@brunoamaral](https://discourse.gohugo.io/u/brunoamaral)\
**Post date:** [November 6, 2021, 3:51pm UTC](https://discourse.gohugo.io/t/unexpected-syntax-error-on-previous-stable-project/35472/5 "2021-11-06T15:51:25Z")

</div>

yes, I do.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [November 6, 2021, 3:56pm UTC](https://discourse.gohugo.io/t/unexpected-syntax-error-on-previous-stable-project/35472/6 "2021-11-06T15:56:26Z")

</div>

With 0.88.1 and earlier, errors detected during minification were ignored. This was fixed with:  
[https://github.com/gohugoio/hugo/pull/8957](https://github.com/gohugoio/hugo/pull/8957)

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [November 8, 2021, 3:56pm UTC](https://discourse.gohugo.io/t/unexpected-syntax-error-on-previous-stable-project/35472/7 "2021-11-08T15:56:45Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
