vuejs/vue-cli · error · Error
Cannot resolve "ts-jest" module. Typescript preset requires…
Error message
Cannot resolve "ts-jest" module. Typescript preset requires "ts-jest" to be installed.
What it means
The typescript jest preset extends the default preset and needs `ts-jest` to transform `.ts`/`.tsx` files. It resolves `ts-jest` via require.resolve and throws if the module is absent, because the transform entry would otherwise point at nothing.
Solutions
- Install ts-jest: `npm i -D ts-jest`.
- Make sure the ts-jest major is compatible with your Jest major (check ts-jest's peer deps).
- Verify the preset path string is correct in jest config.
Defensive patterns
Strategy: validation
Validate before calling
const pkg = require('./package.json')
if (!(pkg.devDependencies || {}).tsJest && !(pkg.devDependencies || {})['ts-jest']) {
console.warn('Typescript jest preset needs ts-jest: run npm i -D ts-jest')
} Try / catch
try { require.resolve('ts-jest') } catch { /* install ts-jest, then re-run jest */ } Prevention
- Whenever you select the typescript/no-type-check preset, also add ts-jest.
- Match ts-jest's peer-supported Jest major.
When it happens
Trigger: Pointing Jest's `preset` at `@vue/cli-plugin-unit-jest/presets/typescript/jest-preset` (or the no-type-check variant) without having `ts-jest` installed.
Common situations: TypeScript project set up for Jest with ts-jest missing from devDependencies; ts-jest removed during dependency pruning; version skew between ts-jest and the installed Jest.
Related errors
- Cannot resolve "@vue/vue
- At least one dependency can't be found. Please install the…
- Can't find in node_modules. Please install the dependencies…
- Can't find in package.json
- Cannot resolve plugin
AI-assisted analysis of vuejs/vue-cli@7eb93c169c (2026-08-13).
Data as JSON: /api/errors/e5a82c83539c64f8.
Report an issue: GitHub.
Appendix: source
Thrown at packages/@vue/cli-plugin-unit-jest/presets/typescript/jest-preset.js:8
const deepmerge = require('deepmerge')
const defaultPreset = require('../default/jest-preset')
let tsJest = null
try {
tsJest = require.resolve('ts-jest')
} catch (e) {
throw new Error('Cannot resolve "ts-jest" module. Typescript preset requires "ts-jest" to be installed.')
}
module.exports = deepmerge(
defaultPreset,
{
moduleFileExtensions: ['ts', 'tsx'],
transform: {
'^.+\\.tsx?$': tsJest
}
}
)
View on GitHub (pinned to 7eb93c169c)