Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

ESLint cannot decide which copy of the @typescript-eslint plugin to use

ErrorESLint couldn't determine the plugin "@typescript-eslint" uniquely.

Short answer

ESLint found the same plugin at two different file paths and will not pick one. The error lists both paths and the config that loaded each. Either two copies are installed, for example one nested inside a shared config, or two config files load it from different folders. Make the path single, or set where plugins are resolved from.

  • Applies to ESLint 8.57 (eslintrc mode), Node.js 22, npm 10
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Read the paths in the error message. ESLint lists, for each copy it found, the file path and the name of the config that loaded it. Two different paths are the whole problem, and which two they are decides the cause: both under node_modules points at a duplicate install, one outside your project points at a stray config.

    npx eslint src
    npm ls @typescript-eslint/eslint-plugin
  2. 2Match what you see, then jump to its fix

    1. 1Both paths in the error end in @typescript-eslint/eslint-plugin, one under your root node_modules and one nested under another package, often a shareable config.Two copies of the plugin are installedFix
    2. 2One of the two paths is outside the folder you are linting, for example in a home directory or the root of a monorepo, and the config that loaded it is not yours.A second .eslintrc in a parent folder loads the plugin from elsewhereFix
    3. 3One path is your project's node_modules and the other belongs to a config or tool that runs ESLint for you.A shared config and your config resolve plugins from different foldersFix

What does the error look like?

  • ESLint couldn't determine the plugin "@typescript-eslint" uniquely.
  • The message lists two file paths for the same plugin, each with the name of the config that loaded it

Cause 1 of 3

Two copies of the plugin are installed

1Check

npm ls with a package name prints every path that leads to that package, nested ones included. More than one version or more than one location confirms it.

npm ls @typescript-eslint/eslint-plugin

2Fix

Bring the versions into line so that one copy satisfies every dependent, then let npm move the shared copy up the tree. npm dedupe only simplifies the tree, it never installs new modules, and a dry run first shows what it would change.

npm dedupe --dry-run
npm dedupe

3Verify

npm ls shows one location, and ESLint runs without the error.

npm ls @typescript-eslint/eslint-plugin
npx eslint src

Confirmed by docs.npmjs.com

Did this fix it?

Cause 2 of 3

A second .eslintrc in a parent folder loads the plugin from elsewhere

1Check

ESLint merges .eslintrc files from the folder of the file upward, until one sets root to true. Each config resolves its plugins from its own folder, so two configs can reach two different installs.

# configs above the project, up to the filesystem root
ls -a .. ../.. | grep -i eslintrc

2Fix

Stop the search at your project by setting root in its config, or delete the stray config.

// .eslintrc.json in the project root
{
  "root": true,
  "plugins": ["@typescript-eslint"]
}

3Verify

Run ESLint again. The plugin is now loaded from the project only, and the error is gone.

npx eslint src

Confirmed by eslint.org

Did this fix it?

Cause 3 of 3

A shared config and your config resolve plugins from different folders

1Check

By default ESLint resolves plugins from the folder of the config file that names them. The CLI option that changes the folder is meant for plugins installed by someone other than the end user, and the docs say to point it at the project that depends on the plugins.

grep -n "eslint" package.json

2Fix

Run ESLint with every plugin resolved from the project folder.

npx eslint --resolve-plugins-relative-to . src

3Verify

The same command now finishes without the plugin error.

npx eslint --resolve-plugins-relative-to . src

Confirmed by eslint.org

Did this fix it?

How do I stop it coming back?

  • Keep one version range for @typescript-eslint/eslint-plugin and @typescript-eslint/parser in the project, and run npm dedupe after a major upgrade.
  • Put root: true in the top .eslintrc of every project, so stray configs above it are not merged.
  • Move to flat config (eslint.config.js): there plugins are imported objects, the root and plugin-path options no longer exist, and a config file acts as if root were set.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Web apps

tsconfig rejects allowImportingTsExtensions

An error that allowImportingTsExtensions needs noEmit or emitDeclarationOnly

allowImportingTsExtensions lets files import each other with .ts or .tsx extensions, and TypeScript only allows it together with noEmit or emitDeclarationOnly.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.