T
TanStack4mo ago
conservation-jade

Tanstack/router: Unable to generate route tree file

Does anyone have an idea about https://github.com/TanStack/router/issues/4912 please ?
GitHub
Unable to generate route tree file (routeTree.gen.ts) during build ...
Which project does this relate to? Router Describe the bug When building a project using TanStack Router with route generation enabled, the build fails with an ENOENT error because the router gener...
4 Replies
absent-sapphire
absent-sapphire4mo ago
we need a reproducible setup somehow
conservation-jade
conservation-jadeOP4mo ago
He ! By reproducing the error, I found the cause. The problem happens because TanStack Router cannot generate the route tree file inside a subfolder that hasn’t been created yet. Since Git doesn’t keep empty folders, the subfolder is missing in CI and the generation fails. The error message isn’t very clear, but the fix is: 👉 Add a .gitkeep file to keep those subfolders in Git. Example:
src/generated/.gitkeep
src/generated/.gitkeep
This way the generated routeTree.gen.ts file has a valid parent folder, and CI won’t fail. 🚀
absent-sapphire
absent-sapphire4mo ago
that should be fixable in the generator ensuring the folder exists want to create a PR for this?
rising-crimson
rising-crimson3mo ago
I've added a check for this to the generator on the Alpha branch. This will be available when Alpha is merged to main.

Did you find this page helpful?