2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Jekyllが `Invalid date ~` でビルドできなくなったので解決したまとめ

Posted at

背景

さっきまで動いていたJekyllがビルドできなくなった。

状況

ここ(unable to build a jekyll site … invalid date #5267)に書いてあるようなエラーが出てビルドができなくなった。

Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/cache/gems/jekyll-3.2.1/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.

解決方法

_config.yml内のexcludeにvendor/*を指定する。
参考:invalid date '0000-00-00' from template #2938

そもそも_config.ymlには以下のような設定サンプルがコメントアウトされて載っている。

_config.yml
# Exclude from processing.
# The following items will not be processed, by default. Create a custom list
# to override the default setting.
# exclude:
#   - Gemfile
#   - Gemfile.lock
#   - node_modules
#   - vendor/bundle/
#   - vendor/cache/
#   - vendor/gems/
#   - vendor/ruby/

私は直前に自作のスクリプトをここに追加した際に以下のように自作のスクリプトだけを追加していた。

_config.yml
# Exclude from processing.
# The following items will not be processed, by default. Create a custom list
# to override the default setting.
exclude:
  - myscript.sh
#   - Gemfile
#   - Gemfile.lock
#   - node_modules
#   - vendor/bundle/
#   - vendor/cache/
#   - vendor/gems/
#   - vendor/ruby/

よく見ると上のコメント欄に

The following items will not be processed, by default. Create a custom list to override the default setting.

と書いてあるが、どうやら一つでもexcludeを記載するとビルドの際にexcludeするファイルやディレクトリは全部記載しないとダメだった模様。

そんなわけでコメントアウトされていたところの#を消して対応

_config.yml
# Exclude from processing.
# The following items will not be processed, by default. Create a custom list
# to override the default setting.
exclude:
  - myscript.sh
  - Gemfile
  - Gemfile.lock
  - node_modules
  - vendor/bundle/
  - vendor/cache/
  - vendor/gems/
  - vendor/ruby/

これで無事にビルドが出来たので解決。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?