Jekyll: Error: Site could not be built, wrong date format

戏子无情 提交于 2019-12-08 03:45:38

问题


When I run this in my command line:

$ bundle exec jekyll serve

I get this error:

Invalid date '': Document 'vendor/cache/gems/jekyll-3.3.0/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.

The front matter in the faulty file looks like this:

---
layout: post
title:  "Welcome to Jekyll!"
date:   <%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>
categories: jekyll update
---

I have updated my gems and installed Xcode. But I still get this error. I run this on: Macbook, macOS Sierra, 10.12.

Can you help?


回答1:


I had same problem and I solved with this comment. Thank you @adeluccar

Solution

If you install gems with bundle using --path flag you need to exclude vendor file, so you just need to add vendor in the _config.yml file.

title: Lorem ipsum
author: Lorem
...
exclude:
  - Gemfile
  - Gemfile.lock
  - vendor


来源:https://stackoverflow.com/questions/39915298/jekyll-error-site-could-not-be-built-wrong-date-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!