npm EBADENGINE "Unsupported engine" in CI - Fix Node Version Mismatch
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.
What this error means
During install npm prints EBADENGINE listing the package, the wanted Node range, and the current version. With engine-strict enabled the install aborts instead of warning.
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'vite@5.0.0',
npm WARN EBADENGINE required: { node: '^18.0.0 || >=20.0.0' },
npm WARN EBADENGINE current: { node: 'v16.20.2', npm: '8.19.4' }
npm WARN EBADENGINE }Common causes
The CI Node version is older than dependencies require
The runner uses a Node major below the engines range a dependency declares, so npm flags the mismatch.
engine-strict turns the warning into a failure
With engine-strict=true in .npmrc, an unsupported engine aborts the install rather than warning.
How to fix it
Pin a supported Node version in CI
- Set the Node version in the setup step to a value inside the required range.
- Re-run the install.
- uses: actions/setup-node@v4
with:
node-version: 20How to prevent it
- 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.