Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"You’re trying to use a layout that does not exist: layout (undefined) (via Error)" #2707

Closed
mehulkar opened this issue Dec 21, 2022 · 4 comments
Labels
bug: lite Debatable whether or not this is a bug. I mean, it’s not great but it’s not really broken either. education

Comments

@mehulkar
Copy link

Operating system

macOS Ventura 13.0.1 (22A400)

Eleventy

2.0.0-canary.20

Describe the bug

Upgraded from 1.0.2 and getting this error on pnpm start

You’re trying to use a layout that does not exist: layout (undefined) (via Error)
> Running Dev Command “npx @11ty/eleventy --serve --watch --port $PORT”
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] You’re trying to use a layout that does not exist: layout (undefined) (via Error)
[11ty] 
[11ty] Original error stack trace: Error: You’re trying to use a layout that does not exist: layout (undefined)
[11ty]     at TemplateLayoutPathResolver.getFullPath (/Users/mehulkar/dev/my-web-site/node_modules/.pnpm/@11ty+eleventy@2.0.0-canary.20/node_modules/@11ty/eleventy/src/TemplateLayoutPathResolver.js:102:13)
[11ty]     at new TemplateLayout (/Users/mehulkar/dev/my-web-site/node_modules/.pnpm/@11ty+eleventy@2.0.0-canary.20/node_modules/@11ty/eleventy/src/TemplateLayout.js:22:7)
[11ty]     at Function.getTemplate (/Users/mehulkar/dev/my-web-site/node_modules/.pnpm/@11ty+eleventy@2.0.0-canary.20/node_modules/@11ty/eleventy/src/TemplateLayout.js:47:18)
[11ty]     at TemplateLayout.getTemplateLayoutMap (/Users/mehulkar/dev/my-web-site/node_modules/.pnpm/@11ty+eleventy@2.0.0-canary.20/node_modules/@11ty/eleventy/src/TemplateLayout.js:93:35)
[11ty]     at async TemplateLayout.getData (/Users/mehulkar/dev/my-web-site/node_modules/.pnpm/@11ty+eleventy@2.0.0-canary.20/node_modules/@11ty/eleventy/src/TemplateLayout.js:122:15)
[11ty]     at async Template.getData (/Users/mehulkar/dev/my-web-site/node_modules/.pnpm/@11ty+eleventy@2.0.0-canary.20/node_modules/@11ty/eleventy/src/Template.js:383:26)
[11ty]     at async TemplateMap.add (/Users/mehulkar/dev/my-web-site/node_modules/.pnpm/@11ty+eleventy@2.0.0-canary.20/node_modules/@11ty/eleventy/src/TemplateMap.js:64:16)
[11ty]     at async Promise.all (index 10)
[11ty]     at async TemplateWriter._createTemplateMap (/Users/mehulkar/dev/my-web-site/node_modules/.pnpm/@11ty+eleventy@2.0.0-canary.20/node_modules/@11ty/eleventy/src/TemplateWriter.js:257:5)
[11ty]     at async TemplateWriter.generateTemplates (/Users/mehulkar/dev/my-web-site/node_modules/.pnpm/@11ty+eleventy@2.0.0-canary.20/node_modules/@11ty/eleventy/src/TemplateWriter.js:294:5)

I can debug further, but opening issue to see if a more helpful error message is possible here!

Reproduction steps

No response

Expected behavior

No response

Reproduction URL

No response

Screenshots

No response

@mehulkar
Copy link
Author

The issue was that I had layout: layout in frontmatter instead of layout: layout.njk. I'm guessing the extension is now required in 2.0. Is there a changelog / breaking change list I can contribute this to (if I'm understanding correctly)?

@zachleat
Copy link
Member

zachleat commented Dec 21, 2022

Restoring this feature in #2708, shipping with v2.0.0-canary.21.

@zachleat zachleat added the bug: lite Debatable whether or not this is a bug. I mean, it’s not great but it’s not really broken either. label Dec 21, 2022
@mehulkar
Copy link
Author

@zachleat fwiw, I’m on board with requiring extensions! Just didn’t know where to check to see the “breaking” changes so I could debug the error. One simple fix in my case would be to wrap the missing layout name in quotes in the error message. Would have made it more obvious that 11ty is looking for something I’ve named.

@zachleat
Copy link
Member

zachleat commented Dec 21, 2022

Ah yeah, no worries! We just got 3 issues on this specifically recently 😅 so I’m gonna slow walk this migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: lite Debatable whether or not this is a bug. I mean, it’s not great but it’s not really broken either. education
Projects
None yet
Development

No branches or pull requests

2 participants