/flags/yarn/yarn-install-ignore-engines
yarn install --ignore-engines: skip the engines check (Yarn 1)
- 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:
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
| Form | Scope |
|---|---|
| yarn install --ignore-engines | This install only |
| yarn add pkg --ignore-engines | Also accepted by add, upgrade and global add |
| yarn config set ignore-engines true | Every Yarn 1 command of this user (~/.yarnrc) |
| ignore-engines true in the project .yarnrc | Everyone working on the project |
| YARN_IGNORE_ENGINES=true | Environment variable, handy in a CI job |
Better fixes
- Use the Node.js version the package needs. Pin it in
.nvmrcor.node-versionand in CI (actions/setup-nodewithnode-version). - Upgrade or downgrade the dependency to a release whose
enginesincludes your Node.js. - 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-enginescovers only theenginesfield; theosandcpuchecks of Yarn 1 are skipped with--ignore-platform.engines.yarnandengines.npmare checked the same way asengines.nodeand are skipped by the flag too.- In Yarn 1 workspaces, the root package's
enginesfield counts as well, so the error can come from your ownpackage.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.