TypeScript "TS2688: Cannot find type definition file for" - Fix in CI
Your compilerOptions.types (or a typeRoots entry) names a type package that is not installed. tsc looks for node_modules/@types/<name> (or the typeRoots path), does not find it, and raises TS2688 at config load.
What this error means
Type-checking fails before checking your code with error TS2688: Cannot find type definition file for '<x>'., naming the entry from your types array or typeRoots.
error TS2688: Cannot find type definition file for 'jest'.
The file is in the program because:
Entry point of type library 'jest' specified in compilerOptionsCommon causes
types array names an uninstalled package
A compilerOptions.types: ["jest", "node"] allowlist names a package whose @types/* is not installed, so tsc cannot find its definition file.
typeRoots points at a missing path
A custom typeRoots entry references a directory that does not exist in CI (e.g. a local types folder not committed), so the named type cannot be located.
How to fix it
Install the named type packages
Add every package listed in types as a dev dependency.
npm install -D @types/jest @types/nodeFix or remove the types/typeRoots entry
Only list type packages you actually install, and point typeRoots at real paths.
// tsconfig.json
{ "compilerOptions": { "types": ["node", "vite/client"] } }How to prevent it
- Install
@types/*for every entry incompilerOptions.types. - Point
typeRootsonly at directories that exist in CI. - Avoid an over-restrictive
typesallowlist you do not keep in sync.