{"record":{"id":"5d09f9bc4660f95a","repo":"vercel/next.js","slug":"it-looks-like-you-re-trying-to-use-typescript-but","errorCode":null,"errorMessage":"It looks like you're trying to use TypeScript but do not have the required package(s) installed.\n\nPlease install ${packagesHuman} by running:\n\n\t${install command} ${packagesCli}\n\nIf you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files in your app and pages directories).","messagePattern":"It looks like you're trying to use TypeScript but do not have the required package\\(s\\) installed\\.\n\nPlease install (.+?) by running:\n\n\t(.+?) (.+?)\n\nIf you are not trying to use TypeScript, please remove the tsconfig\\.json file from your package root \\(and any TypeScript files in your app and pages directories\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/typescript/missingDependencyError.ts","lineNumber":23,"sourceCode":"import { getPkgManager } from '../helpers/get-pkg-manager'\n\nexport function missingDepsError(\n  dir: string,\n  missingPackages: MissingDependency[]\n): never {\n  const packagesHuman = getOxfordCommaList(missingPackages.map((p) => p.pkg))\n  const packagesCli = missingPackages.map((p) => p.install ?? p.pkg).join(' ')\n  const packageManager = getPkgManager(dir)\n\n  const removalMsg =\n    '\\n\\n' +\n    bold(\n      'If you are not trying to use TypeScript, please remove the ' +\n        cyan('tsconfig.json') +\n        ' file from your package root (and any TypeScript files in your app and pages directories).'\n    )\n\n  throw new Error(\n    bold(\n      red(\n        `It looks like you're trying to use TypeScript but do not have the required package(s) installed.`\n      )\n    ) +\n      '\\n\\n' +\n      bold(`Please install ${bold(packagesHuman)} by running:`) +\n      '\\n\\n' +\n      `\\t${bold(\n        cyan(\n          (packageManager === 'yarn'\n            ? 'yarn add --dev'\n            : packageManager === 'pnpm'\n              ? 'pnpm install --save-dev'\n              : 'npm install --save-dev') +\n            ' ' +\n            packagesCli\n        )","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/lib/typescript/missingDependencyError.ts#L5-L41","documentation":"Thrown by missingDepsError() when Next.js detects a tsconfig.json (or .ts files) but the `typescript` (and/or related) package is not installed in node_modules. Next.js requires TypeScript as a peer/dev dependency to type-check and compile .ts routes; without it the build cannot proceed.","triggerScenarios":"Project has a tsconfig.json or .tsx pages but `typescript` is absent from dependencies. Triggered by hasNecessaryDependencies during dev/build startup. The error lists the exact missing packages and the correct install command for your detected package manager (npm/yarn/pnpm).","commonSituations":"Cloning a repo and forgetting `npm install` for devDependencies; using a monorepo where typescript is hoisted incorrectly; deleting node_modules partially; starting from a JS template and adding .ts files without installing typescript.","solutions":["Run the exact install command shown in the message (e.g. `npm install --save-dev typescript @types/react @types/node`).","If you did not intend to use TypeScript, delete tsconfig.json and any .ts/.tsx files in app/ and pages/ directories.","In a monorepo, ensure typescript resolves from the project root (check pnpm hoisting / yarn workspaces)."],"exampleFix":"// before: tsconfig.json exists but typescript not installed\n// after: run\n//   npm install --save-dev typescript @types/react @types/node @types/react-dom","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs'\nimport { resolve } from 'path'\nfunction ensureTypeScriptInstalled(projectDir: string) {\n  if (!existsSync(resolve(projectDir, 'node_modules/typescript/package.json'))) {\n    throw new Error('typescript is not installed. Run: npm install --save-dev typescript')\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep typescript and @types/* in devDependencies.","Run `npm install` (including devDependencies) after cloning.","In monorepos, verify typescript resolves from the project root.","Remove tsconfig.json if you are not using TypeScript."],"tags":["typescript","dependencies","build","installation"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}