# Jekyll on Mac could not read file and invalid date error using bundle exec Jekyll serve

**URL:** <https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664>\
**Category:** Help\
**Created:** [September 17, 2022, 9:53am UTC](https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664 "2022-09-17T09:53:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![min2bro](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@min2bro](https://talk.jekyllrb.com/u/min2bro)\
**Post date:** [September 17, 2022, 9:53am UTC](https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664/1 "2022-09-17T09:53:50Z")

</div>

Error: could not read file /Users/min2bro/Documents/personal//jeklyll/bundle/ruby/3.1.0/gems/jekyll-4.2.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 ‘jeklyll/bundle/ruby/3.1.0/gems/jekyll-4.2.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 ‘jeklyll/bundle/ruby/3.1.0/gems/jekyll-4.2.2/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.2.2 Please append `--trace` to the `serve` command  
for any additional information or backtrace.

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [September 17, 2022, 4:02pm UTC](https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664/2 "2022-09-17T16:02:58Z")

</div>

have you tried using an actual date in the filename? posts are required to start with the date.

---

<div class="post-metadata">

**Author:** ![min2bro](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@min2bro](https://talk.jekyllrb.com/u/min2bro)\
**Post date:** [September 19, 2022, 3:20am UTC](https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664/3 "2022-09-19T03:20:32Z")

</div>

Yes all my posts(md files) start with dates.

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [September 19, 2022, 3:39am UTC](https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664/4 "2022-09-19T03:39:41Z")

</div>

> [@min2bro](#):
>
> 0000-00-00-welcome-to-jekyll.markdown

is that the actual date on that file? the error says it is not a valid date which makes sense.

---

<div class="post-metadata">

**Author:** ![min2bro](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@min2bro](https://talk.jekyllrb.com/u/min2bro)\
**Post date:** [September 19, 2022, 3:43am UTC](https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664/5 "2022-09-19T03:43:40Z")

</div>

That file is not available anywhere in my project folder, Not sure why it’s referring to that file in error statement.

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [September 19, 2022, 7:24am UTC](https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664/6 "2022-09-19T07:24:46Z")

</div>

> [@min2bro](#):
>
> /Users/min2bro/Documents/personal//jeklyll/bundle/ruby/3.1.0/gems/jekyll-4.2.2/lib/site\_template/\_posts/0000-00-00-welcome-to-jekyll.markdown.erb

This file is the source of your error.  
Ideally Jekyll 4.x will ignore the `vendor/*` directories automatically. But it looks like your local Bundler configuration is to save into `/jeklyll/bundle/ruby` instead.

Regardless, please tell us what the output is when you run `bundle config get path`.

---

<div class="post-metadata">

**Author:** ![min2bro](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@min2bro](https://talk.jekyllrb.com/u/min2bro)\
**Post date:** [September 19, 2022, 7:27am UTC](https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664/7 "2022-09-19T07:27:02Z")

</div>

Here is the path I see after running bundle config get path:

Set for the current user (/Users/min2bro/.bundle/config): “jekyll/bundle”

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [September 19, 2022, 10:25am UTC](https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664/8 "2022-09-19T10:25:07Z")

</div>

You need to add the above to your Jekyll config file under the `exclude` key:

```nohighlight
# _config.yml

exclude:
- "jeklyll/bundle"

```

_P.S.: You spelt Jekyll wrong. Irrespective of whether you correct the spelling, you should always configure Jekyll to “exclude” the directory from being read. Alternatively, for future projects, use the popular `vendor/bundle` instead. It is automatically excluded by Jekyll 4.x_
