eleventy: 11ty can't find _includes directory

This error comes up when serving, dry-running or debugging - pretty much the same basic issue:

npx @11ty/eleventy --serve
Problem writing Eleventy templates: (more in DEBUG output)
> TemplateLayoutPathResolver directory does not exist for page.liquid: _includes

`Error` was thrown:
    Error: TemplateLayoutPathResolver directory does not exist for page.liquid: _includes

I have even deleted the _includes folder and moved my two .liquid layout files into _layouts and removed all references to _includes from .eleventy.js - the error persists. I have no idea what is causing this. Help!

Environment:

  • OS and Version: Linux Mint 19.2
  • Eleventy Version 0.9.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

In my case, the problem was I created eleventy.js without the .. It should be .eleventy.js 😐

I had a similar problem and am posting my solution here in case it helps others. My errors only came up when trying to run netlify dev as I’m using Netlify to add some serverless functions, etc.

I put all of my source code in a /src/ directory in my repo and then pointed to it when calling all my scripts:

package.json

  "scripts": {
    "build": "npx @11ty/eleventy --input=src",
    "start": "npx @11ty/eleventy --input=src --serve",
    "watch": "npx @11ty/eleventy --input=src --watch",
    "debug": "DEBUG=* npx @11ty/eleventy --input=src"
  }

Turns out, the default directories were still being queried for in the build. I moved my input directory config to the .eleventy.js file, and I no longer get the error:

module.exports = function (eleventyConfig) {
  // Input directory: src
  // Output directory: _site
  eleventyConfig.addPassthroughCopy("src/style.css")
  eleventyConfig.addPassthroughCopy("src/images/")
  eleventyConfig.setDataDeepMerge(true);
  eleventyConfig.setTemplateFormats("html,njk");

  return {
    dir: {
      input: "src"
    }
  }
}

@dixonge, I also get the error if I mistakenly try to run npx eleventy --serve from a directory other than the root. Is that what happened? (Of course, it’s not a very intuitive error message in that instance.)

I encountered this error today, and I was stumped. For some unknown reason, opening and saving the .eleventy.js file knocked something loose. Now it works. 🤷‍♂️

Change input: “content” for input: “.” and run eleventy from that directory.