Trouble building a new site on WSL: "Error: could not read file"

I’m trying to create add Jekyll to an existing website. I am developing using Windows Subsystem for Linux.

First, I installed the Jekyll ruby gem using these these instructions.

Next, I made a new folder called “website” and ran jekyll build website.

I got the following error:

Source: /home/giangisa
Destination: /home/giangisa/_site
Incremental build: disabled. Enable with --incremental
Generating…
Error: could not read file /home/giangisa/gems/gems/jekyll-4.1.0/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb: Invalid date ‘<%= Time.now.strftime(’%Y-%m-%d %H:%M:%S %z’) %>’: Document ‘gems/gems/jekyll-4.1.0/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb’ does not have a valid date in the YAML front matter.
ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
Invalid date ‘<%= Time.now.strftime(’%Y-%m-%d %H:%M:%S %z’) %>’: Document ‘gems/gems/jekyll-4.1.0/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb’ does not have a valid date in the YAML front matter.
------------------------------------------------
Jekyll 4.1.0 Please append --trace to the build command
for any additional information or backtrace.
------------------------------------------------

Is this a sign that I configured jekyll incorrectly?

Yes, you don’t create a folder and run jekyll build.
The command is jekyll new.

The correct steps would be:

  1. jekyll new website
  2. cd website
  3. bundle exec jekyll build
1 Like

Sorry, I am experience in the same issue but with an existing website. What can I do?

The instructions below are correct for new and build

If the error persists and complains about the invalid date, make sure you have vendor in your excludes or leave out the excludes field completely.

excludes:
    - foo
    - vendor

I have encountered that a few times. Note only matters for jekyll 3 as Jekyll 4 will always ignore vendor, node_modules and similar even if you only add on item to excludes list.

1 Like