Node "The engine 'node' is incompatible" at Runtime in CI - Align Node Versions
A package declares a supported Node range in its engines field. When a tool enforces it strictly and CI runs a Node outside that range, execution is blocked.
What this error means
A CI step fails with The engine "node" is incompatible with this module. Expected version ... Got <version>, because the runner Node is outside the package engines range.
node
error some-cli@3.0.0: The engine "node" is incompatible with this module.
Expected version ">=20". Got "18.19.0"
error Found incompatible module.Common causes
The CI Node version is outside the engines range
The runner runs a Node version the package does not support, and strict engine enforcement blocks it.
A pinned older Node lagging a dependency bump
A dependency raised its minimum Node version, but CI still pins the old one.
How to fix it
Pin a Node version inside the range
- Read the required engines range from the error.
- Set the CI Node version to satisfy it.
GitHub Actions
- uses: actions/setup-node@v4
with:
node-version: 20Declare your own engines to keep CI honest
- Set engines in package.json to the Node range you support.
- Align the CI matrix with it.
package.json
"engines": { "node": ">=20" }How to prevent it
- Keep your engines field, the CI Node matrix, and your dependencies aligned so a Node bump in a dependency is caught and matched in CI.
Related guides
Node "Cannot find module 'node:X'" in CI - Fix the Builtin ImportFix the Node.js "Cannot find module node:X" error in CI by upgrading to a Node version that supports the node…
Node "bad option" Unknown Flag in CI - Fix the Node InvocationFix the Node.js "bad option" unknown-flag error in CI by removing the flag, fixing its spelling, or using a N…
Node Build Flag Rejected as "bad option" in CI - Fix the Build InvocationFix a build step where Node rejects a flag as "bad option" in CI by aligning the Node version with the build…