jestjs/jest · error · Error
Jest: ' ' is required for the TypeScript configuration…
Error message
Jest: '${loader}' is required for the TypeScript configuration files. Make sure it is installed
Error: ${error.message} What it means
Thrown by registerTsLoader when the dynamic import() of the chosen loader package fails with ERR_MODULE_NOT_FOUND. The loader is named in the @jest-config-loader pragma (or defaults to 'ts-node'), but the package is not resolvable from the project. The original error is attached as {cause}.
Solutions
- Install the named loader: npm install -D ts-node (or esbuild-register)
- If in a monorepo, ensure the loader is resolvable from the package running Jest (add to that workspace's deps or fix hoisting)
- Remove the @jest-config-loader pragma and rely on native Node TS support if you're on Node 22.18+/23.6+
- Run node -e "require.resolve('ts-node')" from the project to confirm resolution
Example fix
// before: pragma set, ts-node missing /** * @jest-config-loader ts-node */ // after: install it // npm install -D ts-node
Defensive patterns
Strategy: validation
Validate before calling
import * as fs from 'node:fs';
function assertLoaderInstalled(loader: 'ts-node' | 'esbuild-register'): void {
try {
require.resolve(loader);
} catch {
throw new Error(`${loader} is not installed. Run: npm install -D ${loader}`);
}
} Type guard
async function isLoaderInstalled(loader: string): Promise<boolean> {
try { await import(loader); return true; } catch { return false; }
} Prevention
- Add the chosen loader to devDependencies and commit package.json
- Run npm ci / yarn install --frozen-lockfile in CI to ensure all deps present
- In monorepos, verify resolution from the workspace running Jest
When it happens
Trigger: Declaring @jest-config-loader ts-node without installing ts-node; running in a monorepo where the loader is hoisted to a workspace root Jest cannot resolve from; using esbuild-register without adding it to package.json.
Common situations: Fresh clones where devDependencies weren't installed (yarn install --production); monorepo hoisting differences; CI caches that dropped optional deps.
Related errors
- Jest: ' ' is not a valid TypeScript configuration loader.
- Jest: You can only define a single loader through…
- jest.config.mts requires native TypeScript support. Ensure…
- Jest: Failed to parse the TypeScript config file
- Can't find a root directory while resolving a config file…
AI-assisted analysis of jestjs/jest@8e6d128e4a (2026-08-10).
Data as JSON: /api/errors/a3b224e1d4c1c2f2.
Report an issue: GitHub.
Appendix: source
Thrown at packages/jest-config/src/readConfigFileAndSetRootDir.ts:240
target: `node${process.version.slice(1)}`,
...extraTSLoaderOptions,
});
} else {
instance?.unregister();
}
},
};
}
throw new Error(
`Jest: '${loader}' is not a valid TypeScript configuration loader.`,
);
} catch (error) {
if (
isError(error) &&
(error as NodeJS.ErrnoException).code === 'ERR_MODULE_NOT_FOUND'
) {
throw new Error(
`Jest: '${loader}' is required for the TypeScript configuration files. Make sure it is installed\nError: ${error.message}`,
{cause: error},
);
}
throw error;
}
}
View on GitHub (pinned to 8e6d128e4a)