Fix: ESLint 'Failed to load parser @typescript-eslint/parser' in VS Code

beginner๐Ÿ’ป VS Code2026-07-12| VS Code, Node.js environment, TypeScript projects using ESLint (Legacy Config).

Error Message

Failed to load parser '@typescript-eslint/parser' declared in '.eslintrc.js': Cannot find module '@typescript-eslint/parser'
#eslint#typescript#vscode-extension#node-js#web-development

The Error Message

You open a TypeScript file in VS Code, expecting a clean workspace, but a red notification pops up. Or, you check the ESLint Output console and see this frustrating line:

Failed to load parser '@typescript-eslint/parser' declared in '.eslintrc.js': Cannot find module '@typescript-eslint/parser'

What's going on under the hood?

ESLint is essentially telling you it can't find its translation guide for TypeScript. It knows it needs to use the @typescript-eslint/parser, but the physical files are missing or invisible to the engine. This usually happens for a few specific reasons:

  • The package was never installed or was accidentally deleted.
  • You're working in a monorepo, and VS Code is looking in the root instead of the sub-package.
  • Your parser and ESLint plugin versions are fighting with each other.
  • Your node_modules folder has become corrupted.

Step 1: Install the missing dependencies

Start with the basics. If you just cloned a repo or initialized a new project, you might have missed the parser. Run this command in your project root to ensure everything is present:

# For npm users
npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint

# For yarn users
yarn add -D @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint

# For pnpm users
pnpm add -D @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint

Always install the parser and the eslint-plugin together. They are designed as a pair, and missing one will often break the other.

Step 2: Sync your version numbers

Mismatched versions are a silent killer. If your parser is on version 7.x.x but your plugin is still on 6.x.x, ESLint might fail to bridge the gap. Open your package.json and check the devDependencies section.

Make sure the major versions match exactly, like this:

"devDependencies": {
  "@typescript-eslint/eslint-plugin": "^7.2.0",
  "@typescript-eslint/parser": "^7.2.0",
  "eslint": "^8.57.0"
}

After you edit the file, run npm install or yarn install to apply the changes. Consistency here prevents 90% of parser loading errors.

Step 3: Configure VS Code for Monorepos

In a monorepo setup (like Nx, Turbo, or Yarn Workspaces), VS Code often looks for node_modules in the wrong place. It might search the root folder when the parser is actually hidden inside /apps/web/node_modules.

To fix this, create or edit your .vscode/settings.json file at the very root of your workspace:

{
  "eslint.workingDirectories": [
    { "mode": "auto" }
  ]
}

If "auto" doesn't work, try being explicit. Tell VS Code exactly where your projects live:

{
  "eslint.workingDirectories": [
    "./apps/frontend",
    "./apps/backend",
    "./packages/shared-ui"
  ]
}

Step 4: The Nuclear Option (Clean Reinstall)

Sometimes, dependency trees just get messy. If you've verified the versions and the paths but the error won't go away, it's time to nuke the node_modules folder. This clears out any ghost files or corrupted symlinks.

# Delete the folders and the lockfile
rm -rf node_modules
rm package-lock.json # or yarn.lock / pnpm-lock.yaml

# Fresh install
npm install

Step 5: Force-restart the ESLint Server

VS Code is notorious for caching old errors. You might have fixed the file on disk, but the ESLint extension is still looking at a "failed" snapshot. Don't restart your whole computer; just restart the server.

  • Press Ctrl + Shift + P (or Cmd + Shift + P on Mac).
  • Type "ESLint: Restart ESLint Server".
  • Hit Enter and wait a few seconds.

Verification

Is it actually fixed? Open a .ts file and check the bottom status bar in VS Code. You should see a small "ESLint" icon. If it has a checkmark or no icon at all, you're in the clear. If you see a red 'x', click it to open the Output panel and see what's left to fix.

Quick Tips

  • Avoid Global Installs: Never run npm install -g eslint. Global parsers often conflict with local project versions, leading to the exact error you're seeing now.
  • Check Node Versions: If you're on an ancient version of Node (like v14) while trying to run ESLint 9, you'll run into compatibility walls. Use nvm to stay on a modern LTS version like v20.

Related Error Notes