Skip to content
Latchkey

ESLint "Parsing error: Cannot find module '@typescript-eslint/parser'" in CI

Your ESLint config sets parser: "@typescript-eslint/parser", but that package is not installed in the CI environment, so ESLint cannot parse any .ts file and reports a parsing error.

What this error means

Every TypeScript file fails with "Parsing error: Cannot find module '@typescript-eslint/parser'" and the lint step exits non-zero, while JS files lint fine.

ESLint
/home/runner/work/app/app/src/index.ts
  0:0  error  Parsing error: Cannot find module '@typescript-eslint/parser'
Require stack:
- /home/runner/work/app/app/node_modules/...

Common causes

The parser package is not installed

The config references @typescript-eslint/parser, but it is missing from package.json so a clean install on the runner never provisions it.

Dev dependencies were omitted in CI

A production-only install pruned the parser and the @typescript-eslint plugin, which are dev dependencies.

How to fix it

Install the parser and plugin

  1. Add @typescript-eslint/parser and @typescript-eslint/eslint-plugin to devDependencies.
  2. Commit the lockfile.
  3. Install dev dependencies in the lint job.
Terminal
npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin

Keep the install in the lint job

Run a full install (not production-only) before ESLint.

.github/workflows/ci.yml
- run: npm ci
- run: npx eslint . --ext .ts,.tsx

How to prevent it

  • List the parser and plugin in devDependencies and the lockfile.
  • Avoid --omit=dev in jobs that run ESLint.
  • Pin parser and plugin versions together to avoid peer mismatches.

Related guides

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