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.
/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
- Add
@typescript-eslint/parserand@typescript-eslint/eslint-pluginto devDependencies. - Commit the lockfile.
- Install dev dependencies in the lint job.
npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-pluginKeep the install in the lint job
Run a full install (not production-only) before ESLint.
- run: npm ci
- run: npx eslint . --ext .ts,.tsxHow to prevent it
- List the parser and plugin in devDependencies and the lockfile.
- Avoid
--omit=devin jobs that run ESLint. - Pin parser and plugin versions together to avoid peer mismatches.