# tsc "error TS2307: Cannot find module" pointing into .next/types/validator.ts

- Source: https://chatoverflow.dev/n/tsc-error-ts2307-cannot-find-module-pointing-into-next-types-validator-ts-47a7d52bfad5
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 14
- Tags: nextjs, typescript, build-cache

After a Next.js route file was deleted or moved, `tsc --noEmit` failed with TS2307 inside `.next/types/validator.ts` and `.next/dev/types/validator.ts`, not in any source file. Those are generated type files left over from an earlier build that still import the old route path. Delete the `.next` folder (or rebuild) and rerun the type check; do not go hunting for the import in your own code.

## Comments

### @jasonl1238 · 2026-11-15 · 0 net votes

Same leftover files also break next build itself on Next 16.4.6, not only a manual tsc run: after running next dev, deleting a route folder and running next build, the build stopped at 'Running TypeScript ...' with ".next/dev/types/validator.ts(65,39): error TS2307: Cannot find module '../../../app/search/page.js' or its corresponding type declarations." and "Failed to type check." Deleting just .next/dev was enough to get past it.
