Jekyll Serve gives Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>'

Hello,

I am trying to serve and receiving the following error. Any guidance appareciated.

_config.yaml has:

exclude:
   - Gemfile
   - Gemfile.lock
   - node_modules
   - vendor/bundle/
   - vendor/cache/
   - vendor/gems/
   - vendor/ruby/
(base) jamess-MacBook-Pro-2:jekyll_site jamesdhope$ bundle exec jekyll serve --incremental
Configuration file: /Users/jamesdhope/Documents/Projects/jamesdhope.github.io/jekyll_site/_config.yml
            Source: /Users/jamesdhope/Documents/Projects/jamesdhope.github.io/jekyll_site
       Destination: /Users/jamesdhope/Documents/Projects/jamesdhope.github.io/jekyll_site/_site
 Incremental build: enabled
      Generating... 
             Error: could not read file /Users/jamesdhope/Documents/Projects/jamesdhope.github.io/jekyll_site/vendor/bundle /gems/jekyll-3.5.2/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 'vendor/bundle /gems/jekyll-3.5.2/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 'vendor/bundle /gems/jekyll-3.5.2/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.
(base) jamess-MacBook-Pro-2:jekyll_site jamesdhope$ 

Looks like you have a space in the path between bundle and gems: bundle /gems while in the exclude section you haven’t considered it.

1 Like

Indeed that looks like the issue.

Try delete vendor

Then set up again

bundle config set --local path 'vendor/bundle'

Here are my regular bundle commands for reference


By the way your excludes bit can also be much shorter

exclude:
   - Gemfile # implies Gemfile* so matches Gemfile.lock
   - node_modules/ 
   - vendor/ # matches vendor/*

Here is my template file