Next.js Discord

Discord Forum

Type generation: routes.js not created before validator.ts import

Unanswered
Atlantic horse mackerel posted this in #help-forum
Open in Discord
Atlantic horse mackerelOP
# Type Generation Error

.next/dev/types/validator.ts:5:56 - error TS2307: Cannot find module './routes.js' or its corresponding type declarations.
5 import type { AppRoutes, LayoutRoutes, ParamMap } from "./routes.js"
                                                         ~~~~~~~~~~~~~
Found 1 error in .next/dev/types/validator.ts:5
error: "tsc" exited with code 1


## Fix

rm -rf .next
bun next typegen && bun tsc --noEmit


## Versions

- Next.js: 16.2.0-canary.35
- React: 19.2.4
- TypeScript: 5.9.3
- Node: 24.13.1
- OS: macOS (darwin) 24.6.0

---

TS2307: Cannot find module './routes.js'

0 Replies