How to fix npm ERR! code EOVERRIDE npm ERR! Override not allowed in npm

npmINTERMEDIATEMEDIUMUpdated Dec 6, 2025· 278 views

The EOVERRIDE error occurs when npm's override validation detects a version specification conflict between your overrides and direct dependencies. Use the $ reference syntax or ensure exact version matches to resolve it.

Quick fix

Fixes EOVERRIDE

"dependencies": {
  "axios": "^1.6.0"
},
"overrides": {
  "axios": "$axios"
}
  1. Use the $ reference syntax
  2. Ensure exact version match
  3. Remove conflicting overrides
  4. Regenerate package-lock.json
npm — error
"dependencies": {
"axios": "^1.6.0"
},
"overrides": {
"axios": "$axios"
}
npm ERR! code EOVERRIDE
npm ERR! Override not allowed

What this error means

This error indicates that npm's dependency resolver found an invalid override configuration in your package.json. The overrides feature (available in npm 8.3.0+) lets you substitute package versions throughout your dependency tree, but it has strict rules about how overrides interact with direct dependencies. When you have a package listed both as a direct dependency and in your overrides section, npm requires either: (1) the version specifications to match exactly, or (2) the use of the special `$package-name` reference syntax. Any mismatch triggers EOVERRIDE because npm cannot safely determine which version to install. This validation exists to prevent scenarios where your override might accidentally downgrade or conflict with a package you explicitly depend on.

Typical symptoms

  • Installation fails with "Override for [package] conflicts with direct dependency"
  • npm install and npm ci both fail with EOVERRIDE
  • Error appears after adding or modifying the overrides section
  • Works on npm 7.x but fails after upgrading to npm 8.3+
  • Monorepo projects show errors when workspace dependencies have conflicting overrides
  • CI builds fail while local builds might work with cached node_modules

Common causes

  1. Override version doesn't match the direct dependency version specification
  2. Using exact version in override while dependency uses range (or vice versa)
  3. Missing the $ reference syntax for packages that are also direct dependencies
  4. package-lock.json is out of sync with package.json overrides
  5. Different npm versions between development and CI environments
  6. Inherited overrides from a parent workspace conflicting with local dependencies

How to fix "npm ERR! code EOVERRIDE npm ERR! Override not allowed"

1Use the $ reference syntax

For packages that are both direct dependencies and overrides, use the reference syntax:

json
"dependencies": {
  "axios": "^1.6.0"
},
"overrides": {
  "axios": "$axios"
}

The $axios syntax tells npm to use the version from your dependencies, keeping them automatically synchronized.

2Ensure exact version match

If you prefer explicit versions, make sure both specifications are identical:

json
"devDependencies": {
  "react-error-overlay": "^6.0.9"
},
"overrides": {
  "react-error-overlay": "^6.0.9"
}

The strings must match exactly—^6.0.9 is not the same as 6.0.9.

3Remove conflicting overrides

If the override isn't essential, simply remove it:

json
"overrides": {
  // Remove entries that conflict with direct dependencies
}

Overrides are typically only needed for transitive dependencies, not packages you directly control.

4Regenerate package-lock.json

Clear the lockfile and node_modules to force npm to recalculate the dependency tree:

bash
rm -rf node_modules package-lock.json
npm install

This resolves issues where the lockfile contains stale override resolutions.

5Check npm version compatibility

Ensure consistent npm versions across environments:

bash
npm --version

The overrides feature requires npm 8.3.0 or later. In CI, pin your npm version to avoid surprises:

yaml
# GitHub Actions example
- uses: actions/setup-node@v4
  with:
    node-version: '20'

Advanced notes

The EOVERRIDE error is distinct from EOVERRIDECONFLICT—both relate to override validation but trigger under slightly different conditions. EOVERRIDE typically indicates the override itself is not permitted, while EOVERRIDECONFLICT indicates a version mismatch.

In monorepos using npm workspaces, overrides in the root package.json apply to all workspaces. If a workspace has a different version requirement, you may need workspace-specific override handling or restructure your dependencies.

When migrating from Yarn (which uses the resolutions field), note that npm's overrides has different syntax and stricter validation rules. You cannot simply rename the field.

Frequently asked questions

What does "EOVERRIDE" mean?
json. 0+) lets you substitute package versions throughout your dependency tree, but it has strict rules about how overrides interact with direct dependencies. When you have a package listed both as a direct dependency and in your overrides section, npm requires either: (1) the version specifications to match exactly, or (2) the use of the special $package-name reference syntax.
How do I fix "EOVERRIDE"?
The EOVERRIDE error occurs when npm's override validation detects a version specification conflict between your overrides and direct dependencies. Use the $ reference syntax or ensure exact version matches to resolve it.
What causes "EOVERRIDE"?
Override version doesn't match the direct dependency version specification Using exact version in override while dependency uses range (or vice versa) Missing the $ reference syntax for packages that are also direct dependencies
Is the "EOVERRIDE" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading