npm EBADENGINE: Unsupported engine and the Node version behind it
EBADENGINE compares package engines with your Node build. Align .nvmrc, engines, and CI images, and understand when engine-strict makes it fatal.

Introduction & Quick Summary
npm install in CI finishes its progress bar and then prints:
npm WARN EBADENGINE Unsupported engine {
package: 'vite@6.3.5',
required: { node: '^18.0.0 || ^20.0.0 || >=22.0.0' },
current: { node: 'v18.17.1', npm: '9.6.7' }
}or, when strict mode is on:
npm ERR! code EBADENGINE
npm error notsup Required: {"node":">=20.19.0"}
npm error notsup Actual: {"npm":"10.8.2","node":"v18.20.4"}Quick answer: the installed Node.js does not satisfy a package.json engines range. Normally npm only warns; it fails hard when engine-strict=true is set in .npmrc, or when you pass --engine-strict. Fix the runtime rather than the flag:
node -v # what you have
cat .nvmrc 2>/dev/null # what the project wants
npm config get engine-strict # true or false
nvm install --lts && nvm use # or volta/asdf to match engines
rm -rf node_modules package-lock.json && npm ciThe warning is easy to dismiss and expensive to ignore: a package whose code uses node:sqlite, Promise.withResolvers, or native modules built against a newer ABI will fail at import time or at runtime, long after the install looked fine.
Core Mechanics, Signatures & Reproducible Setup
engines is a field in package.json describing the runtimes a package supports:
{
"name": "my-app",
"engines": {
"node": ">=20.19.0 <25",
"npm": ">=10"
},
"packageManager": "pnpm@10.4.1"
}npm evaluates this field for the root project and for every dependency it reads, then compares the result against process.versions.node of the npm process. Three rules decide the outcome:
engine-strict=false(the default) turns a mismatch intoWARN EBADENGINEand continues.engine-strict=trueturns it intoERR! code EBADENGINEand aborts before writing tonode_modules.- The check compares ranges, not versions, so a pre-release tag such as
v22.0.0-rc.1fails a>=22range unless the range names the pre-release.
Reproduce it locally without touching a real project:
mkdir ebadengine && cd ebadengine
cat > package.json <<'EOF'
{ "name": "t", "version": "1.0.0",
"engines": { "node": ">=20" }, "dependencies": { "ms": "^2.1.3" } }
EOF
printf 'engine-strict=true\n' > .npmrc
npm install # ERR! code EBADENGINE on Node 18
sed -i 's/>=20/>=18/' package.json # or upgrade Node
npm install # succeedsThe message always names both sides — required from the manifest, current from the runtime — so there is no ambiguity about which package and which engine.
Key Comparison Table
Strictness differs by package manager, which matters when only one of them fails:
| Package manager | Default on mismatch | Flag to enforce | Message |
|---|---|---|---|
| npm 9/10/11 | warning | engine-strict=true in .npmrc | WARN EBADENGINE / ERR! code EBADENGINE |
| pnpm 9/10 | error for the root project | engine-strict=false to relax | ERR_PNPM_UNSUPPORTED_ENGINE |
| Yarn 1 | warning | --ignore-engines to relax | The engine "node" is incompatible |
| Yarn 4 (berry) | error | enableEngineChecks setting | YN0002-style engine report |
| Bun | warning | --frozen-lockfile unaffected | warn: ... requires node |
Which failure you are looking at:
| Message | Raised by | Meaning |
|---|---|---|
WARN EBADENGINE | npm, non-strict | install continued, package may misbehave |
code EBADENGINE | npm, strict | install aborted |
ERR_PNPM_UNSUPPORTED_ENGINE | pnpm | root project engine mismatch |
notsup Required/Actual | npm | the two ranges being compared |
Cannot find module 'node:sqlite' | Node runtime | the engine warning was real |
Fixing it, and what each option costs:
| Option | Effort | Risk |
|---|---|---|
| upgrade Node in CI and locally | one line in the workflow | none, and it matches the package's support window |
add .nvmrc plus engines to the repo | small | needs a version manager in every environment |
pin with packageManager and Corepack | small | Corepack must be enabled on the runner |
engine-strict=false | one line | defers a runtime failure to the worst moment |
npm install --force | one flag | skips peer and engine checks, hides real breakage |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
1. Find the package that actually wants the newer Node
npm ls --depth=0
npm explain vite # which path pulled the package in
node -p "process.versions.node"
npx -y npm@10 ls --json > deps.jsonnpm explain prints the dependency chain, which is what you need when a fresh transitive dependency raises the engine floor two days before a release.
2. Align the repository so every machine agrees
// package.json
{ "engines": { "node": ">=20.19.0 <25" } }# .nvmrc
20.19.0# .github/workflows/ci.yml
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- run: npm cinode-version-file removes the second source of truth; a workflow that hardcodes node-version: 18 will drift the moment .nvmrc changes.
3. npm itself can be the mismatch
The notsup block includes an npm entry, so a project with "npm": ">=10" fails under npm 9 even with Node 22. The fix is npm i -g npm@10, or Corepack, which also pins the package manager per repository:
corepack enable
corepack use pnpm@10.4.1 # writes packageManager and installs it4. Docker and devcontainer base images
FROM node:18-alpine is the most common source of EBADENGINE in a pipeline that passes locally:
# dockerfile
FROM node:22.14-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run buildPin the major version the engines field allows, and let Renovate or Dependabot bump both files in one pull request so they cannot diverge.
5. When the dependency, not you, is above your runtime
An old application on Node 18 pulling a package that requires >=20 has three honest options: upgrade the application, pin the package to its last compatible major (overrides in npm, resolutions in Yarn), or accept the warning and test the affected code path.
{ "overrides": { "vite": "5.4.19" } }overrides changes one subtree and keeps the rest current, which is usually smaller than a runtime upgrade done under deadline — but it must be paired with a test that exercises the feature you are pinning.
6. Reading the installed tree instead of the lockfile
npm ci --engine-strict # fail early, in CI
npm ls --all 2>/dev/null | grep -i "invalid\|UNMET" | headRunning strict in CI and loose locally is a useful asymmetry: developers get a warning they can finish their task with, and the merge gate is the place that refuses.
Common Compilation/Runtime Mistakes & Version Gotchas
Putting engines only in the root package.json and expecting enforcement. It describes your project; it does not restrict dependencies. Enforcement is engine-strict, and it applies to every package npm reads.
Using --force to make the message go away. npm install --force skips engine and peer validation together, so a genuine React version conflict and a Node version conflict disappear from the log at the same time. The build fails later with a less obvious message.
Assuming engine-strict is inherited from a parent folder. npm reads .npmrc from the project, then the user config; a CI runner with engine-strict=true in ~/.npmrc will fail installs that pass on a laptop, and the error looks unrelated to the change that triggered it.
Range syntax surprised. "node": "18" means exactly 18.x and excludes 20 and 22. ">=18" allows 18 through 25 and is the usual intent. "^18 || ^20 || >=22" is the shape most libraries now ship, and it is why a Node 18.17 install can fail a package that accepts Node 18 generally.
Version boundaries worth knowing. npm 7 changed peer-dependency resolution and made more engine checks visible. Node 18 reached end of life in April 2025, and the packages that dropped it did so with a major bump, so a lockfile regeneration — not a code change — is often what triggers EBADENGINE. pnpm 10 enforces root engines by default and adds onlyBuiltDependencies prompts, which makes it stricter than npm on the same project.
Confirming the runtime is what you think. Print process.versions.node from inside the failing step; a PATH entry pointing at an old Node from a version manager is a frequent cause. The environment variable reference helps untangle PATH, NODE_OPTIONS, and proxy variables in one place, and the JSON formatter is handy for diffing two package.json files when a monorepo has several.
Reference material: package.json engines and npm config engine-strict.
Official references
primary documentationThe Node.js documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit Node.js work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related Node.js guides
All Node.js guidesNode.js: ERR_DLOPEN_FAILED invalid ELF header
Invalid ELF header means a native addon was built for another OS or architecture. Rebuild it inside the target image instead of copying node_modules.
Node.js ERR_INVALID_ARG_TYPE: the argument must be of type
ERR_INVALID_ARG_TYPE is Node's validator naming a wrong argument. Read the quoted argument, validate at the boundary and default env values.
ERR_MODULE_NOT_FOUND: Cannot find module imported from an ESM file
ESM resolves specifiers literally: extensions are required, directories do not resolve to index files, and exports maps block deep imports.
Node.js 26 upgrade: rmdir, native addons and removed flags
Three breaks stop a deploy: rmdir with recursive throws, the transform-types flag is gone, and the module ABI moved to 147.
More in Node.js
All Node.js guidesThe guides filed next to this one in Node.js, in library order.