{"record":{"id":"1d8399359c37619c","repo":"cypress-io/cypress","slug":"no-typescript-installable-was-found-ts-loader-nee","errorCode":null,"errorMessage":"No typescript installable was found. ts-loader needs a version of typescript to work properly. Please install typescript in your project's package.json.","messagePattern":"No typescript installable was found\\. ts-loader needs a version of typescript to work properly\\. Please install typescript in your project's package\\.json\\.","errorType":"exception","errorClass":"TypeScriptNotFoundError","httpStatus":null,"severity":"error","filePath":"npm/webpack-batteries-included-preprocessor/index.ts","lineNumber":112,"sourceCode":"\n  let typeScriptPath: string | boolean | undefined | null = null\n\n  try {\n    if (options.typescript === true) {\n      const configFileDirectory = path.dirname(configFile?.path ?? '')\n\n      // attempt to resolve typescript from the user's tsconfig.json file / project directory\n      typeScriptPath = require.resolve('typescript', { paths: [configFileDirectory] })\n      options.typescript = typeScriptPath\n    } else {\n      typeScriptPath = options.typescript\n    }\n\n    debug(`using typescript found at ${typeScriptPath}`)\n  } catch {\n    debug('no user typescript found. Throwing TypeScriptNotFoundError')\n\n    throw new TypeScriptNotFoundError()\n  }\n  // shortcut if we know we've already added typescript support\n  // @ts-expect-error - not typed intentionally\n  if (options.__typescriptSupportAdded) return options\n\n  const webpackOptions = options.webpackOptions\n  const rules = webpackOptions.module && webpackOptions.module.rules\n\n  // if there are no rules defined or it's not an array, we can't add to them\n  if (!rules || !Array.isArray(rules)) return options\n\n  // if we find ts-loader configured, don't add it again\n  if (hasTsLoader(rules)) {\n    debug('ts-loader already configured, not adding again')\n\n    return options\n  }\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/npm/webpack-batteries-included-preprocessor/index.ts#L94-L130","documentation":"Thrown as TypeScriptNotFoundError by @cypress/webpack-batteries-included-preprocessor when require.resolve('typescript', { paths: [configFileDirectory] }) fails. ts-loader needs the `typescript` package present to type-check and emit; the preprocessor tries to resolve typescript from the user's tsconfig directory (when options.typescript === true) or from the explicit path (options.typescript as string), and throws if neither resolves.","triggerScenarios":"addTypeScriptConfig reaches the require.resolve('typescript', ...) branch (because options.typescript is true or a path string) and Node throws MODULE_NOT_FOUND. Occurs when TypeScript is not installed in the project, is installed only as a transitive dep not resolvable from the tsconfig dir, or options.typescript points at a nonexistent path.","commonSituations":"A TS Cypress project where `typescript` was never added to package.json devDependencies, a monorepo where typescript lives in the root but the spec's tsconfig dir cannot resolve it, or a stale npm install.","solutions":["Install TypeScript in the project: `npm install -D typescript`.","If using a monorepo, ensure typescript is resolvable from the directory of your tsconfig.json (hoist it or add to that workspace).","If options.typescript is set to a path, verify the path exists and points at a valid typescript module.","Reinstall dependencies if you recently changed Node majors (native modules / hoisting shifts)."],"exampleFix":"// before: tsconfig.json present but typescript not installed\n// after\nnpm install -D typescript@5","handlingStrategy":"validation","validationCode":"import { createRequire } from 'module'\nfunction ensureTypescriptResolvable(dir: string) {\n  try { createRequire(import.meta.url).resolve('typescript', { paths: [dir] }) }\n  catch { throw new Error('Install typescript: npm i -D typescript') }\n}","typeGuard":"const isTypescriptResolvable = (dir: string): boolean => { try { createRequire(import.meta.url).resolve('typescript', { paths: [dir] }); return true } catch { return false } }","tryCatchPattern":"try { addTypeScriptConfig(file, options) } catch (e) { if (e.name === 'TypeScriptNotFoundError') { /* npm i -D typescript, retry */ } else throw e }","preventionTips":["List typescript in devDependencies of the project that runs Cypress.","In monorepos, ensure typescript resolves from the tsconfig.json directory.","Validate options.typescript path strings before passing to the preprocessor."],"tags":["webpack","typescript","preprocessor","dependency","module-not-found"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}