ESLint "Cannot find module '@typescript-eslint/parser'"
ESLint's config sets parser: '@typescript-eslint/parser' (directly or via a shareable config), but the parser package is not installed. ESLint cannot parse a single file without it, so every file errors.
What this error means
ESLint fails with Parsing error: Cannot find module '@typescript-eslint/parser' (often "Require stack" beneath it). Nothing lints because the parser cannot load.
eslint
/app/src/index.ts
0:0 error Parsing error: Cannot find module '@typescript-eslint/parser'
Require stack:
- /app/node_modules/@eslint/eslintrc/dist/eslintrc.cjsCommon causes
Parser package not installed
The config names @typescript-eslint/parser but it is missing from package.json, or a clean npm ci did not install it (only present locally before).
Pulled in transitively, not declared
The parser appeared only as a transitive dependency of a shareable config; when hoisting changes, the direct reference can no longer resolve it.
How to fix it
Install the parser (and the plugin) as dev deps
Terminal
npm install -D @typescript-eslint/parser @typescript-eslint/eslint-plugin
# flat config: npm install -D typescript-eslintDeclare every config dependency directly
- List
@typescript-eslint/parser(and@typescript-eslint/eslint-plugin) indevDependencies. - Do not rely on a shareable config to provide a parser you reference directly.
- Install with
npm ciso CI matches the lockfile exactly.
How to prevent it
- Declare the ESLint parser and TypeScript plugin in
devDependencies. - Install with
npm cifor reproducible lint dependencies. - Avoid relying on transitive hoisting for the parser.
Related guides
ESLint "Parsing error: The keyword 'import' is reserved"Fix ESLint "Parsing error: The keyword 'import' is reserved" / "Unexpected token import" in CI - parserOption…
CI "eslint: command not found" - Fix Missing ESLint BinaryFix "eslint: command not found" (exit 127) in CI - ESLint is not installed, or the step calls a global `eslin…
ESLint "Failed to load config to extend from" - Missing Config in CIFix ESLint "Failed to load config '<x>' to extend from" in CI - a shareable config referenced in extends but…