# Hugo + Netlify で独自ブログ開設を試みたが、ビルドでエラーが発生する

**URL:** <https://discourse.gohugo.io/t/hugo-netlify/27778>\
**Category:** 日本語\
**Created:** [August 23, 2020, 2:56pm UTC](https://discourse.gohugo.io/t/hugo-netlify/27778 "2020-08-23T14:56:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Capr1](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@Capr1](https://discourse.gohugo.io/u/Capr1)\
**Post date:** [August 23, 2020, 2:56pm UTC](https://discourse.gohugo.io/t/hugo-netlify/27778/1 "2020-08-23T14:56:32Z")

</div>

1. 困ったこと  
Hugo + Netlifyで独自ブログ開設を試みたが、ビルドでエラーが発生する

2. エラー内容  
11:54:55 PM: │ Netlify Build │  
11:54:55 PM: └─────────────────────────────┘  
11:54:55 PM: ​  
11:54:55 PM: ❯ Version  
11:54:55 PM: @netlify/build 3.3.0  
11:54:55 PM: ​  
11:54:55 PM: ❯ Flags  
11:54:55 PM: deployId: 5f42833354270439486cd0f5  
11:54:55 PM: mode: buildbot  
11:54:55 PM: ​  
11:54:55 PM: ❯ Current directory  
11:54:55 PM: /opt/build/repo  
11:54:55 PM: ​  
11:54:55 PM: ❯ Config file  
11:54:55 PM: /opt/build/repo/netlify.toml  
11:54:55 PM: ​  
11:54:55 PM: ❯ Context  
11:54:55 PM: production  
11:54:55 PM: ​  
11:54:55 PM: ┌────────────────────────────────────┐  
11:54:55 PM: │ 1. build.command from netlify.toml │  
11:54:55 PM: └────────────────────────────────────┘  
11:54:55 PM: ​  
11:54:55 PM: $ hugo --theme=zzo --buildDrafts --gc --minify  
11:55:00 PM: Building sites … ERROR 2020/08/23 14:55:00 JSON parse error: unexpected comma character on line 9 and column 20  
11:55:00 PM: 9: “description”: ,  
11:55:00 PM: ^  
11:55:00 PM: ERROR 2020/08/23 14:55:00 JSON parse error: unexpected comma character on line 9 and column 20  
11:55:00 PM: 9: “description”: ,  
11:55:00 PM: ^  
11:55:00 PM: Total in 5033 ms  
11:55:00 PM: Error: Error building site: failed to render pages: JSON parse error: unexpected comma character on line 9 and column 20  
11:55:00 PM: 9: “description”: ,  
11:55:00 PM: ^  
11:55:00 PM: ​  
11:55:00 PM: ┌─────────────────────────────┐  
11:55:00 PM: │ “build.command” failed │  
11:55:00 PM: └─────────────────────────────┘  
11:55:00 PM: ​  
11:55:00 PM: Error message  
11:55:00 PM: Command failed with exit code 255: hugo --theme=zzo --buildDrafts --gc --minify  
11:55:00 PM: ​  
11:55:00 PM: Error location  
11:55:00 PM: In build.command from netlify.toml:  
11:55:00 PM: hugo --theme=zzo --buildDrafts --gc --minify  
11:55:00 PM: ​  
11:55:00 PM: Resolved config  
11:55:00 PM: build:  
11:55:00 PM: command: hugo --theme=zzo --buildDrafts --gc --minify  
11:55:00 PM: commandOrigin: config  
11:55:00 PM: environment:  
11:55:00 PM: - HUGO\_VERSION  
11:55:00 PM: - HUGO\_ENV  
11:55:00 PM: - HUGO\_ENABLEGITINFO  
11:55:00 PM: publish: /opt/build/repo/public  
11:55:00 PM: Caching artifacts  
11:55:00 PM: Started saving build plugins  
11:55:00 PM: Finished saving build plugins  
11:55:00 PM: Started saving pip cache  
11:55:00 PM: Finished saving pip cache  
11:55:00 PM: Started saving emacs cask dependencies  
11:55:00 PM: Finished saving emacs cask dependencies  
11:55:00 PM: Started saving maven dependencies  
11:55:00 PM: Finished saving maven dependencies  
11:55:00 PM: Started saving boot dependencies  
11:55:01 PM: Finished saving boot dependencies  
11:55:01 PM: Started saving go dependencies  
11:55:01 PM: Finished saving go dependencies  
11:55:03 PM: Error running command: Build script returned non-zero exit code: 1  
11:55:03 PM: Failing build: Failed to build site  
11:55:03 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1  
11:55:03 PM: Finished processing build request in 18.205461886s

3.独自ブログのGitHubリポジトリ

> **[KazuyaMatsunaga/capr1net-blog](https://github.com/KazuyaMatsunaga/capr1net-blog)**
>
> Contribute to KazuyaMatsunaga/capr1net-blog development by creating an account on GitHub.

1. その他情報  
使用テーマ：Zzo

---

<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:** [August 23, 2020, 3:27pm UTC](https://discourse.gohugo.io/t/hugo-netlify/27778/2 "2020-08-23T15:27:07Z")

</div>

This is a problem with the Zzo theme. See:

> <https://github.com/zzossig/hugo-theme-zzo/issues/285>
>
> Hello
> I encountered the following problem while building Site.
> $ hugo --minify
> Building sites … ERROR 2020/06/09 20:56:12 JSON parse error: unexpected comma character...

Please raise the issue with the theme’s author.

---

<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:** [August 23, 2020, 3:51pm UTC](https://discourse.gohugo.io/t/hugo-netlify/27778/3 "2020-08-23T15:51:19Z")

</div>

Options:

1. Run `hugo` without the `--minify` option, OR

2. Disable JSON minification by adding this to the bottom of your config.toml file:

---

<div class="post-metadata">

**Author:** ![peaceiris](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/peaceiris/32/7358_2.png) [@peaceiris](https://discourse.gohugo.io/u/peaceiris)\
**Post date:** [August 23, 2020, 4:57pm UTC](https://discourse.gohugo.io/t/hugo-netlify/27778/4 "2020-08-23T16:57:15Z")

</div>

commit hash `a7b1fb87599b76570654e9ddc3e74c52a8f0b2f9` [https://github.com/KazuyaMatsunaga/capr1net-blog/tree/a7b1fb87599b76570654e9ddc3e74c52a8f0b2f9](https://github.com/KazuyaMatsunaga/capr1net-blog/tree/a7b1fb87599b76570654e9ddc3e74c52a8f0b2f9)

の時点のリポジトリを clone して手元で build してみましたが (`netlify.toml` の通り hugo v0.71.0 でテスト) error は無かったですね。

```auto
git clone https://github.com/KazuyaMatsunaga/capr1net-blog.git
cd capr1net-blog
git submodule update --init --recursive
docker run --rm -i -t -v ${PWD}:/src peaceiris/hugo:v0.71.0 --theme=zzo --buildDrafts --gc --minify

```

ローカルでのビルドでエラーが発生するのであれば、何か手がかりをつかめそうですが、Netlify 上でのみエラーが発生するような状況でしょうか?

@jmooring が見つけてくれたように [Build site JSON parse error · Issue #285 · zzossig/hugo-theme-zzo](https://github.com/zzossig/hugo-theme-zzo/issues/285) で zzo theme author も問題を再現できなかったようなので、かなり特殊な問題なのかもしれません。

とりあえずの回避策としては @jmooring と同じで `disableJSON = true` をオススメします。

---

<div class="post-metadata">

**Author:** ![Capr1](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@Capr1](https://discourse.gohugo.io/u/Capr1)\
**Post date:** [August 23, 2020, 5:14pm UTC](https://discourse.gohugo.io/t/hugo-netlify/27778/5 "2020-08-23T17:14:45Z")

</div>

@jmooring が指摘してくれたように `disableJSON = true`を追加し、リポジトリにpushしたら直りました．

また`disableJSON = true`を削除し、一回ローカルでビルドし、生成されたファイル（？）ごとリポジトリにpushしたら、それでもちゃんと動きました．

理由はよくわかりませんが、 @jmooring , @peaceiris さん、ありがとうございます．
