Skip to content
Latchkey

tsc --noEmit passes locally but fails in CI

tsc reports errors in CI that you do not see locally, which points at an environment difference, not a flaky check.

What this error means

npm run type-check is clean on your machine but the same command fails on the runner with real TS errors.

tsc
Local: tsc --noEmit -> 0 errors
CI:    tsc --noEmit -> error TS2307: Cannot find module ... (and others)

Common causes

How to fix it

Pin and use the lockfile TypeScript

  1. Install from the lockfile and run the local tsc, not a global one
shell
npm ci
npx tsc --version
npx tsc --noEmit

Clear caches and check casing

  1. Delete stale .tsbuildinfo and re-run
  2. Match import casing to filenames for case-sensitive runners
shell
rm -f tsconfig.tsbuildinfo

How to prevent it

  • Pin TypeScript in devDependencies, run tsc via npx from the lockfile, and enable forceConsistentCasingInFileNames.

Frequently asked questions

What causes "tsc passes locally, fails in CI"?
npm run type-check is clean on your machine but the same command fails on the runner with real TS errors.
How do I fix tsc passes locally, fails in CI?
Pin and use the lockfile TypeScript

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card