# npm EBADENGINE "Unsupported engine" in CI - Fix Node Version Mismatch

> Fix "npm WARN EBADENGINE unsupported engine" in CI by matching the runner Node version to the engines field your dependencies require.

Source: https://latchkey.dev/learn/node-js/npm-ebadengine-unsupported-engine-warning-in-ci  
Updated: 2026-06-26

EBADENGINE means a package declares an engines range that the current Node or npm version does not satisfy. It warns by default but can hard-fail when engine-strict is on.

## Diagnose it: reproduce the CI install locally

Install failures are usually environment drift rather than a broken lockfile: a different package-manager major, a different Node version, or a cache that is being restored from a run with different inputs. Reproduce the CI conditions before changing the lockfile, because regenerating it hides the real cause.

```Terminal
# match the runner exactly, then install from a clean slate
node --version && npm --version
rm -rf node_modules
npm ci --foreground-scripts

# if that succeeds locally but fails in CI, the difference is the cache
# or the package-manager version, not your lockfile
```

> Pin the package manager with Corepack (`"packageManager"` in package.json) so the runner and every developer machine resolve the same version. Version skew is the single most common source of lockfile errors that only appear in CI.

## Verify the fix survives a cold cache

A green run immediately after a fix often proves nothing, because it restored a cache written before the change. Force a cold install once to confirm the fix is real.

```.github/workflows/ci.yml
# temporarily bust the cache key to prove the fix on a cold runner
- uses: actions/setup-node@v4
  with:
    node-version: 22
    cache: npm
    cache-dependency-path: package-lock.json
# then bump this suffix once, run, and remove it
#   key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}-v2
```

## FAQ

### What causes npm EBADENGINE "Unsupported engine" in CI?

There are 2 common causes: the ci node version is older than dependencies require and engine-strict turns the warning into a failure. The runner uses a Node major below the engines range a dependency declares, so npm flags the mismatch.

### How do I fix npm EBADENGINE "Unsupported engine" in CI?

Pin a supported Node version in CI. Set the Node version in the setup step to a value inside the required range.

### What does npm EBADENGINE "Unsupported engine" in CI actually mean?

During install npm prints EBADENGINE listing the package, the wanted Node range, and the current version.

### How do I stop npm EBADENGINE "Unsupported engine" in CI happening again?

Declare your own engines field, pin the Node version in setup-node, and keep it inside the intersection of every dependency engines range so installs stay clean.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
