Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to build a jekyll site … invalid date #5267

Closed
cchorn opened this issue Aug 21, 2016 · 24 comments

Comments

@cchorn
Copy link
Contributor

@cchorn cchorn commented Aug 21, 2016

when trying to build a jekyll site with "jekyll serve" I get this error:

Generating...
ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
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.

I used several jekyll templates to test, all with the same result, including the simple test template from the jekyll main page, i.e., "my-awesome-site"

  • I believe this to be a bug, not a question about using Jekyll.
  • I Updated to the latest Jekyll (or) if on Github Pages to the latest github-pages
  • I Read the CONTRIBUTION file at https://jekyllrb.com/docs/contributing/
  • This is a feature request.

  • I am on (or have tested on) _macOS_ 10+
  • I am on (or have tested on) _Debian/Ubuntu_ GNU/Linux
  • I am on (or have tested on) _Fedora_ GNU/Linux
  • I am on (or have tested on) _Arch_ GNU/Linux
  • I am on (or have tested on) _Other_ GNU/Linux
  • I am on (or have tested on) _Windows_ 10+

  • I was trying to install.
  • There is a broken Plugin API.
  • I had an error on Github Pages, and I have not tested locally.
  • I had an error on Github Pages, and Github Support said it was a Jekyll Bug.
  • I had an error on Github Pages and I did not test it locally.
  • I was trying to build.
  • It was another bug.

My Reproduction Steps

The Output I Wanted

@crispgm

This comment has been minimized.

Copy link
Member

@crispgm crispgm commented Aug 21, 2016

It seems that you use the .erb template to generate new site.

To create a new site, you may use jekyll new your-site-name instead.

@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 21, 2016

The same issue occurs:
using:
jekyll new your-site-name
bundle install
bundle exec jekyll serve

ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
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.

The file "0000-00-00-welcome-to-jekyll.markdown.erb" contains the following header:

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

categories: jekyll update

@ashmaroli

This comment has been minimized.

Copy link
Member

@ashmaroli ashmaroli commented Aug 21, 2016

Are you trying to serve a clone of the jekyll github repository?
then make sure you cd into the site folder before jekyll serve
If not, follow these exact steps:

$ jekyll new Your New Blog
$ cd your new blog
$ bundle install
$ bundle exec jekyll serve
@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 21, 2016

Yes, I used "cd" and I was in the folder. I still have the error message.

@ashmaroli

This comment has been minimized.

Copy link
Member

@ashmaroli ashmaroli commented Aug 21, 2016

Can you list the exact steps followed once again? Thanks.
(including any changes you made to the defaults..)

@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 21, 2016

Here are the steps. I repeated this again with the same result, an error:
(no changes to the defaults, these are the exact steps) Thanks

jekyll new testblog
cd testblog
bundle install
bundle exec jekyll serve

error

Generating... ERROR: YOUR SITE COULD NOT BE BUILT: ------------------------------------ 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.

@ashmaroli

This comment has been minimized.

Copy link
Member

@ashmaroli ashmaroli commented Aug 21, 2016

The steps are correct. So you should've got a nice message:
New jekyll site installed in /path/to/testblog

If you check that dir, You should find a Gemfile and a _config.yml (alongwith few others); all this in that very directory. These are all that jekyll needs to serve.
The issue is hence within your system. Perhaps, its not able to pass the system date n time to Jekyll.

@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 21, 2016

Correct, I can see the the gemfile and _config.yml. I expected it would build a "_site" directory but this is not present.

@ashmaroli

This comment has been minimized.

Copy link
Member

@ashmaroli ashmaroli commented Aug 21, 2016

Try uninstalling jekyll, delete jekyll gem cache from vendor/cache and re-install with
gem install jekyll --no-document

@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 21, 2016

I completed these steps, uninstall, deleted gem cache, and re-install but no luck. Still the same error.

@ashmaroli

This comment has been minimized.

Copy link
Member

@ashmaroli ashmaroli commented Aug 21, 2016

This issue would've made a lot more sense if _posts/0000-00-00-welcome-to-jekyll.markdown.erb was actually /path/to/testblog/_posts/0000-00-00-welcome-to-jekyll.markdown.erb. Then, it would've been close to jekyll being at fault.
Sorry Charles, I wont be able to assist you, any further.

@DirtyF

This comment has been minimized.

Copy link
Member

@DirtyF DirtyF commented Aug 21, 2016

@cchorn Can't reproduce your error. What version of Ruby are you running?

@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 21, 2016

ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 22, 2016

I've solved it! It seems that you need to place the line exclude: [vendor] in _config.yml
found this on the following issue:
#2938

@ashmaroli

This comment has been minimized.

Copy link
Member

@ashmaroli ashmaroli commented Aug 22, 2016

Thank you for referencing the old issue.
I havent read through completely, but Parker has explained the reason why it works in one of the comments.

Think the documentation needs to add a note about this under "Troubleshooting.."

@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 22, 2016

Yes, that is a good idea.
Thanks

@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 22, 2016

I submitted a request to add this to the documentation, using jekyll-help at the bottom of this page: https://jekyllrb.com/docs/troubleshooting/

@ashmaroli

This comment has been minimized.

Copy link
Member

@ashmaroli ashmaroli commented Aug 22, 2016

jekyll-help is no longer maintained. You can create a pull-request by clicking on the "Improve this page" at the top-right of the article.

@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 22, 2016

Thanks. I've done this.

@pathawks

This comment has been minimized.

Copy link
Member

@pathawks pathawks commented Aug 22, 2016

So, this issue can be closed?

@cchorn

This comment has been minimized.

Copy link
Contributor Author

@cchorn cchorn commented Aug 22, 2016

Yes

@cchorn cchorn closed this Aug 22, 2016
dentarg added a commit to klubbdinmamma/klubbdinmamma.github.io that referenced this issue Oct 23, 2016
https://jekyllrb.com/docs/troubleshooting/#configuration-problems

> If you encounter an error in building the site, with the error message
> “‘0000-00-00-welcome-to-jekyll.markdown.erb’ does not have a valid
> date in the YAML front matter.” try including the line exclude:
> [vendor] in _config.yml.

Found via jekyll/jekyll#5267.
marians added a commit to marians/www.sendung.de that referenced this issue Dec 11, 2016
@BrittanyIRL

This comment has been minimized.

Copy link

@BrittanyIRL BrittanyIRL commented Feb 21, 2017

Just saying thank you, I ran into this error and this thread saved me hours

finelli added a commit to finelli/dist-prog-book that referenced this issue Apr 14, 2017
mstred added a commit to geeknightrecife/geeknightrecife.github.io that referenced this issue May 10, 2017
shadowimmage added a commit to shadowimmage/shadowimmage.github.io that referenced this issue May 25, 2017
@HiKWang

This comment has been minimized.

Copy link

@HiKWang HiKWang commented Jun 8, 2017

it works!Thanks!

rindek added a commit to netguru/design-process that referenced this issue Jun 22, 2017
seenukarthi added a commit to seenukarthi/seenukarthi.github.com that referenced this issue Jun 26, 2017
barrymcgee added a commit to anthonydillon/vanillaframework.io that referenced this issue Jun 26, 2017
This was causing the build to break; see: jekyll/jekyll#5267 (comment)
torstenwalter pushed a commit to torstenwalter/torstenwalter.github.io that referenced this issue Aug 3, 2017
Torsten Walter
torstenwalter added a commit to torstenwalter/torstenwalter.github.io that referenced this issue Aug 3, 2017
@linbo linbo referenced this issue Aug 20, 2017
@Atlas7

This comment has been minimized.

Copy link

@Atlas7 Atlas7 commented Dec 5, 2017

Awesome life saver thank you! Just to add: to incorporate Travis CI to the Jekyll site you need to add the exclude: [vendor] in both _config.yml and .travis.yml. (only learnt just now!)

@jekyll jekyll locked and limited conversation to collaborators Dec 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
9 participants
You can’t perform that action at this time.