{"record":{"id":"0cc681668d0879b7","repo":"cube-js/cube","slug":"typescript-dependency-not-found-please-run-this-c","errorCode":null,"errorMessage":"Typescript dependency not found. Please run this command from project directory.","messagePattern":"Typescript dependency not found\\. Please run this command from project directory\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-server/src/server/container.ts","lineNumber":53,"sourceCode":"}\n\nexport class ServerContainer {\n  protected isCubeConfigEmpty: boolean = true;\n\n  public constructor(\n    protected readonly configuration: { debug: boolean }\n  ) {\n  }\n\n  protected getTypeScriptCompiler(): TypescriptCompilerType {\n    if (packageExists('typescript', isDockerImage())) {\n      // eslint-disable-next-line global-require\n      const { TypescriptCompiler } = require('./typescript-compiler');\n\n      return new TypescriptCompiler();\n    }\n\n    throw new Error(\n      'Typescript dependency not found. Please run this command from project directory.'\n    );\n  }\n\n  protected compareBuiltInAndUserVersions(builtInVersion: SemVer, userVersion: SemVer) {\n    const compareResult = semverCompare(builtInVersion, userVersion);\n\n    if (this.configuration.debug) {\n      console.log('[runProjectDockerDiagnostics] compare', {\n        builtIn: builtInVersion.raw,\n        user: userVersion.raw,\n        compare: compareResult,\n      });\n    }\n\n    if (compareResult === -1) {\n      console.log(\n        `${color.yellow('warning')} You are using old Docker image (${getMajorityVersion(builtInVersion, true)}) `","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-server/src/server/container.ts#L35-L71","documentation":"When resolving the TypeScript compiler configuration, the container requires the local TypescriptCompiler module but cannot proceed because the TypeScript dependency is not resolvable from the current working directory. Cube expects to run from a project directory where typescript is installed. The error tells the user to run from a project directory.","triggerScenarios":"Running a cubejs-server based app from a directory with no node_modules containing typescript (no package.json / installed deps), e.g. invoking the CLI globally from an arbitrary cwd, or typescript missing from dependencies while a .ts schema/config is used.","commonSituations":"Global install of cube CLI without local node_modules; Docker image built without typescript in production deps; running `cubejs-server` from a home or temp directory instead of the project root; monorepo hoisting removed typescript from the expected location.","solutions":["cd into your project directory (the one with package.json and node_modules) and re-run the command","Run `npm install typescript --save-dev` (or `yarn add -D typescript`) in the project directory","Verify node_modules/typescript exists at runtime (e.g. in Docker: ensure deps installed before CMD)","Use the built-in JavaScript schema mode if you do not need TypeScript"],"exampleFix":"# before\n$ cubejs-server   # run from ~ or arbitrary dir\n\n# after\n$ cd /path/to/my-project\n$ yarn add -D typescript\n$ yarn dev","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\nif (!fs.existsSync(path.join(process.cwd(), 'node_modules', 'typescript'))) {\n  throw new Error('Run from project directory with typescript installed');\n}","typeGuard":"null","tryCatchPattern":"try {\n  await startServer();\n} catch (e) {\n  if (/Typescript dependency not found/.test(e.message)) {\n    console.error('Install typescript in the project directory: yarn add -D typescript');\n  }\n  throw e;\n}","preventionTips":["Run Cube from the directory containing package.json and node_modules","Include typescript in devDependencies when using a cube.ts schema","In Docker, install all dependencies before switching to the production CMD","Avoid global-only installs if the project relies on locally resolved modules"],"tags":["typescript","dependency-resolution","configuration"],"backgroundTag":"missing-dependency","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}