11Ty conflict error: multiple files are writing to a file that doesn't exist
smolcodes opened this issue · comments
Describe the bug
I get this error when I try to build my site:
> Output conflict: multiple input files are writing to `dist/tag/11ty/index.html`. Use distinct `permalink` values to resolve this conflict.
1. ./src/tags.md
2. ./src/tags.md
`DuplicatePermalinkOutputError` was thrown:
(Repeated output has been truncated…)
at TemplateMap.checkForDuplicatePermalinks (C:\Users\rachelscomputer\Documents\java-blog\node_modules\@11ty\eleventy\src\TemplateMap.js:547:13)
at TemplateMap.cache (C:\Users\rachelscomputer\Documents\java-blog\node_modules\@11ty\eleventy\src\TemplateMap.js:308:10)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async TemplateWriter._createTemplateMap (C:\Users\rachelscomputer\Documents\java-blog\node_modules\@11ty\eleventy\src\TemplateWriter.js:170:5)
at async TemplateWriter.writeTemplates (C:\Users\rachelscomputer\Documents\java-blog\node_modules\@11ty\eleventy\src\TemplateWriter.js:203:5)
at async TemplateWriter.write (C:\Users\rachelscomputer\Documents\java-blog\node_modules\@11ty\eleventy\src\TemplateWriter.js:254:25)
at async Eleventy.write (C:\Users\rachelscomputer\Documents\java-blog\node_modules\@11ty\eleventy\src\Eleventy.js:743:13)
Copied 58 files / Wrote 0 files in 1.73 seconds (v0.12.1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! smolcodes@2.0.0 build:eleventy: `eleventy`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the smolcodes@2.0.0 build:eleventy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\rachelscomputer\AppData\Roaming\npm-cache\_logs\2021-10-02T04_33_44_648Z-debug.log
The thing is, I only have one tags.md file and the file dist/tag/11ty/index.html doesn't exist. I suspect it's pulling posts from another 11ty project that I have. Although I don't know why it is doing that or how to stop it. So I deleted dist/tag/11ty/index.html from all my projects yet the same error message still persists.
I built my other 11ty sites to see if they worked just fine and they did. My java-blog seems to be the only one with the problem.
To Reproduce
- Download the code from here https://github.com/smolcodes/java-blog
- Try to build it.
Expected behavior
I deleted my local files, redownloaded them from my Github and re-encountered the same problem
I expected the problem to be resolved but was met with the same error.
Environment:
- OS and Version: Windows 10
- Eleventy Version : 0.12.1
Short answer: I think you need a space after the hyphen in src/posts/firstpost.md#6: "-11ty".
Longer answer: It looks like there are two tags/collections that are roughly "11ty" that slug-ify to the same thing, which is why they both try and write to the same file and cause the conflict.
Given your blog layout/schema, we can try grepping for "tags:" front matter [and the following line] and then further filter by things that likely have tags related to "11ty", like so:
git grep -n -A1 "tags:" src/posts | grep "11ty"
src/posts/2020-06-26-11ty.md:5:tags:
src/posts/2020-06-26-11ty.md-6- ['accessibility', "11ty", "piccallili"]
src/posts/2021-01-22-tailwindcss.md:7:tags: ['tailwindcss','11ty']
src/posts/firstpost.md-6- -11ty
It doesn't look to suspicious, but since there were only 3 results I tried modifying them one at a time. As best as I can tell, the "-11ty" tag was literally creating a tag with the hyphen, which when slugified turns into "11ty", hence the collision.
The fix is to change it to the following:
diff --git a/src/posts/firstpost.md b/src/posts/firstpost.md
index d579090..3d556dd 100644
--- a/src/posts/firstpost.md
+++ b/src/posts/firstpost.md
@@ -3,7 +3,7 @@ title: Setting Up Eleventy
description: This is a post on My Blog about agile frameworks.
date: 2020-05-04
tags:
- -11ty
+ - 11ty
---
And now, you should be able to run npm run build and the site will build:
Copied 58 files / Wrote 72 files in 1.88 seconds (26.1ms each, v0.12.1)
That's exactly what the problem was! I fixed the tag on that post and everything works great now. Thank you.
Thank you also for showing me how you found the problem. I would have never thought to look at the way I wrote tags on a post from so long ago.