Skip to content

/errors/yarn/engine-node-is-incompatible

yarn: error The engine "node" is incompatible with this module. Expected version ">=18". Got "16.20.2"

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
Yarn
exit code
1
versions
Yarn 1.x
os
any

error <package>: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.20.2" means Yarn 1 (Classic) compared the running Node.js version with the engines.node range of a package and the version does not match. The package named before the colon is the one that sets the range: your project or one of its dependencies. Switch to a Node.js version inside the range shown after Expected version.

Reproduce it

bash
cat > package.json <<'EOF'
{ "name": "app", "version": "1.0.0", "license": "MIT", "engines": { "node": ">=99" } }
EOF
npx --yes yarn@1 install 2>&1 | grep '^error' | sed -E 's/Got "[0-9.]+"/Got "<current>"/'
exit "${PIPESTATUS[0]}"

Output · exit 1

error app@1.0.0: The engine "node" is incompatible with this module. Expected version ">=99". Got "<current>"
error Found incompatible module.

The sed replaces the Node.js version, which depends on the machine. The second line, error Found incompatible module., is printed once for all incompatible packages.

Fix

Check which version is required and which one runs:

bash
cat > package.json <<'EOF'
{ "name": "app", "version": "1.0.0", "engines": { "node": ">=18" } }
EOF
node -p "require('./package.json').engines.node"
node -p "process.versions.node.split('.')[0] >= 18 ? 'ok' : 'too old'"

Output

>=18
ok

Then switch versions with your version manager, for example nvm install 22 && nvm use 22, or set node-version in actions/setup-node in CI.

npm only warns (EBADENGINE Unsupported engine) unless engine-strict is set; Yarn 1 fails by default.

Sources