jekyll: Jekyll cannot locate any files in _includes

  • 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 ran jekyll doctor to check my configuration
  • I read the CONTRIBUTION file at https://jekyllrb.com/docs/contributing/
  • I am on (or have tested on) Other GNU/Linux
  • I was trying to build.

My Reproduction Steps

See my follow up comment for more info.

I ran into this bug after copying the theme files from a custom remote theme into the local repository and updating _config.yml to no longer use jekyll-remote-theme, then trying to serve the site locally. Console output is below and I think the issue is fairly straightforward.

(personal) [pty2] ~/mysite (branch:master*) » bundle exec jekyll serve                                                                                                                                 1 ↵
Configuration file: /home/colin/mysite/_config.yml
            Source: /home/colin/mysite
       Destination: /home/colin/mysite/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
  Liquid Exception: Could not locate the included file 'disqus_comments.html' in any of ["/home/colin/mysite/_includes", "/home/colin/.gem/ruby/2.3.0/gems/jekyll-theme-primer-0.5.2/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source. in /_layouts/post.html
jekyll 3.6.2 | Error:  Could not locate the included file 'disqus_comments.html' in any of ["/home/colin/mysite/_includes", "/home/colin/.gem/ruby/2.3.0/gems/jekyll-theme-primer-0.5.2/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source.
(personal) [pty2] ~/mysite (branch:master*) » ll /home/colin/mysite/_includes                                                                                                                   1 ↵
total 18K
-rwxr-xr-x+ 1 colin None  705 Jan 24 21:20 disqus_comments.html
-rwxr-xr-x+ 1 colin None  915 Jan 24 21:20 footer.html
-rwxr-xr-x+ 1 colin None  568 Jan 24 21:20 google-analytics.html
-rwxr-xr-x+ 1 colin None  504 Jan 24 21:20 head.html
-rwxr-xr-x+ 1 colin None 1.7K Jan 24 21:20 header.html
-rwxr-xr-x+ 1 colin None 3.4K Jan 24 21:20 social.html

As you can see, disqus_comments.html clearly exists in the directory Jekyll is looking for it in. I run into the same issue with the other includes files if I remove the tag that is trying to load disqus_comments.html. There are no symlinks used here. The command I used to copy the theme files into mysite was cp -R _includes _layouts _sass assets ../mysite from a local directory with the remote theme files cloned into it.

Additionally, if I git reset all the changes to _config.yml, remove everything I copied over, and go back to using the remote theme, this issue stops occurring.

The Output I Wanted

A successful build

Additional troubleshooting info

(personal) [pty2] ~/mysite (branch:master*) » bundle exec jekyll doctor
Configuration file: /home/colin/mysite/_config.yml
  Your test results are in. Everything looks fine.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (12 by maintainers)

Most upvoted comments

I think it has something to do with github-pages having a default theme… so you removing theme: minima automatically activates theme: jekyll-theme-primer and conflicts with the remote-theme: setting…

On an unrelated note, here’s what I do to test a site with a theme called in from an external yet local repo… (I’m on Windows…)

Test Site Path: C:\Projects\Test Site Local Jekyll Repo Path: C:\Projects\jekyll Local Theme Repo Path: C:\Projects\minima

# Gemfile in Test Site

gem "jekyll", :path => File.expand_path("../jekyll", __dir__)
gem "minima", :path => File.expand_path("../minima", __dir__)

Now I just need to use Git to use various versions of Jekyll or Minima as I prefer, without having to constantly bundle update