Skip to content
Latchkey

TypeScript "error TS5057: Cannot find a tsconfig.json file" in CI

tsc was invoked with -p / --project pointing at a directory or file that does not contain a tsconfig.json. In CI the cause is almost always a wrong working directory or an unbuilt workspace path.

What this error means

tsc exits immediately with TS5057 before compiling anything. The same command works locally because you run it from the package root, but CI runs it from the repo root or a different folder.

node
error TS5057: Cannot find a tsconfig.json file at the
specified directory: './packages/web'.

Common causes

Wrong working directory in CI

The job runs tsc -p packages/web from a directory where that relative path does not resolve, or the package was not checked out into the expected location.

The project path points at a folder, not a file

tsc accepts a directory only if it contains a tsconfig.json. If the config is named differently (tsconfig.build.json) the directory form fails.

How to fix it

Point -p at the exact config file

Pass the full path to the config so there is no ambiguity about which file or directory tsc should read.

workflow
tsc -p ./packages/web/tsconfig.json
# or set the working directory first
# working-directory: packages/web

Set the job working directory

Run the compile step from the package root so the default tsconfig.json lookup succeeds.

  1. Add working-directory: packages/web to the build step.
  2. Confirm the checkout actually contains that path (use ls to verify in a debug run).
  3. Use tsc -p tsconfig.json from that directory.

How to prevent it

  • Reference tsconfig by full file path in CI commands.
  • Verify the checkout layout with a one-time ls -la debug step when adding a new workspace.
  • Keep config filenames consistent across packages.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →