11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
17.32k stars 495 forks source link

Running debug saying directory does not exist for file #3469

Closed msm1227 closed 1 month ago

msm1227 commented 2 months ago

Operating system

macOS Sonoma Version 14.5

Eleventy

2.0.1

Describe the bug

I am trying to start the process of speeding up my build time so want to run debug. In my package.json I have

 "scripts": {
    "eleventy": "npx @11ty/eleventy --serve --config=eleventy.cjs",
    "tailwind": "npx tailwindcss -i src/static/css/tailwind.css -o _site/static/css/style.css --watch",
    "debug": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy",
    "css": "postcss src/static/css/tailwind.css --o _site/static/css/style.css --watch",
    "start": "eleventy --config=eleventy.cjs --serve & npx tailwindcss -i src/static/css/tailwind.css -c tailwind.config.js -o _site/static/css/style.css --watch",
    "build": "ELEVENTY_PRODUCTION=true eleventy --config=eleventy.cjs && NODE_ENV=production npx tailwindcss -i src/static/css/tailwind.css -c tailwind.config.js -o _site/static/css/style.css --minify",
    "prettier": "npx prettier --write **/*.html",
    "api": "json-server --host 0.0.0.0 --port 6060 --watch json-server/db.json --routes json-server/routes.json"
  },

When I run that I get the following error:

[11ty] Problem writing Eleventy templates: [11ty] TemplateLayoutPathResolver directory does not exist for base.njk: _includes (via Error) Eleventy:Benchmark Benchmark 41ms 23% 1× (Aggregate) Searching the file system (templates) +0ms Eleventy:Benchmark Benchmark 6ms 3% 1× (Aggregate) Searching the file system (data) +0ms Eleventy:Benchmark Benchmark 0ms 0% 470× (Aggregate) Template Read +0ms

In my eleventy.cjs file I have:

  return {
    dir: {
      input: "src",
      includes: '_includes'
    },
    htmlTemplateEngine: "njk",
  };

Here is a screenshot of my directory structure (eleventy.cjs and package.json are in the root directory with src): image

Thanks!

Reproduction steps

No response

Expected behavior

No response

Reproduction URL

No response

Screenshots

No response

zachleat commented 1 month ago

eleventy.cjs is not a default config file name so I’m guessing you need this

     "eleventy": "npx @11ty/eleventy --serve --config=eleventy.cjs",
-    "debug": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy",
+    "debug": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy --config=eleventy.cjs",
zachleat commented 1 month ago

This is an automated message to let you know that a helpful response was posted to your issue and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.

If the response works to solve your problem—great! But if you’re still having problems, do not let the issue’s closing deter you if you have additional questions! Post another comment and we will reopen the issue. Thanks!