Skip to content

/flags/yarn/yarn-install-ignore-engines

yarn install --ignore-engines: skip the engines check (Yarn 1)

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
Yarn
command
yarn install
flag
--ignore-engines
default
false (an incompatible engines field stops the install)

Yarn 1 (Classic) compares the engines field of your project and every dependency with the running Node.js version and stops the install with The engine "node" is incompatible with this module when one does not match. yarn install --ignore-engines skips that check and installs anyway. It is a stop-gap for a package with an overly strict engines range; when the range is accurate, switching Node.js versions is the real fix. Yarn 2 and later have no such check and no such flag.

The check and the flag

The project declares that it needs a Node.js version that does not exist:

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

Output

--- yarn install
error app@1.0.0: The engine "node" is incompatible with this module. Expected version ">=99". Got "<current>"
error Found incompatible module.
--- yarn install --ignore-engines
success Saved lockfile.
exit: 0

Without the flag the install exits with an error; with it Yarn writes the lockfile and finishes. The full explanation of the error, with the version-manager fix, is on The engine "node" is incompatible with this module.

Ways to apply it

FormScope
yarn install --ignore-enginesThis install only
yarn add pkg --ignore-enginesAlso accepted by add, upgrade and global add
yarn config set ignore-engines trueEvery Yarn 1 command of this user (~/.yarnrc)
ignore-engines true in the project .yarnrcEveryone working on the project
YARN_IGNORE_ENGINES=trueEnvironment variable, handy in a CI job

Better fixes

  1. Use the Node.js version the package needs. Pin it in .nvmrc or .node-version and in CI (actions/setup-node with node-version).
  2. Upgrade or downgrade the dependency to a release whose engines includes your Node.js.
  3. Use the flag only for a known-false range, for example an old package with "node": "<=16" that works fine on newer versions, and leave a comment where you set it.

Pitfalls

  • --ignore-engines covers only the engines field; the os and cpu checks of Yarn 1 are skipped with --ignore-platform.
  • engines.yarn and engines.npm are checked the same way as engines.node and are skipped by the flag too.
  • In Yarn 1 workspaces, the root package's engines field counts as well, so the error can come from your own package.json.
  • Yarn 1 is in maintenance mode; the differences to modern Yarn are summarised in Yarn classic vs Yarn Berry.

FAQ

Does Yarn 4 have --ignore-engines?

No. Yarn 2 and later do not check the engines field of dependencies at all, so the flag does not exist there. Only the packageManager field and Corepack decide which Yarn runs.

How do I set ignore-engines permanently?

Run yarn config set ignore-engines true, which writes it to ~/.yarnrc, or add ignore-engines true to the project's .yarnrc. Prefer fixing the Node.js version instead; the setting hides real incompatibilities.

Does npm check engines?

npm only warns (EBADENGINE) unless engine-strict=true is set in .npmrc. Yarn 1 is the strict one by default, which is why the error is common after switching from npm.

Sources