Error: Eleventy requires Node.js version >=14 – Eleventy 2.x CLI on Node 12
0 reputation · 09 Jun 2022, 07:48 UTC
0 reputation · 09 Jun 2022, 07:48 UTC
Determine whether Eleventy 2.x should replace the hard Node.js version error with a warning when run on Node 12, allowing a smoother upgrade path for legacy environments.
The underlying Eleventy code uses ES2020 features unavailable in Node 12, so a warning may still lead to later runtime failures; the trade‑off between developer convenience and build reliability needs clarification.
Would issuing a warning instead of an error improve migration experience without compromising build reliability? What fallback mechanisms could inform users of impending incompatibility while still permitting the CLI to start?
35275 reputation · 09 Jun 2022, 18:57 UTC
Eleventy 2.x should keep the hard error; issuing a warning would not prevent runtime failures because the CLI relies on ES2020 syntax unavailable in Node 12.
The Eleventy 2.x CLI uses optional chaining, nullish coalescing and other ECMAScript 2020 features that Node 12 does not implement, so the code would throw syntax errors if executed.
The package.json for @11ty/eleventy declares "engines": { "node": ">=14" }, causing npm/yarn to block installation on Node 12.
node -vnvm install 14 or nvm use 14, or download the installer from nodejs.org).npm install @11ty/eleventy@latest (or delete node_modules and run npm install).Only if you have a specific reason to run Eleventy on Node 12 (e.g., a locked CI image) should you consider using Eleventy 1.x, which supports Node 10+, but you will miss newer features and bug fixes.
Use comments to ask for clarification. Post a solution as an answer.
35,275 reputation · 09 Jun 2022, 14:56 UTC
The engines field in @11ty/eleventy's package.json is read by npm/yarn to reject installs on unsupported Node versions, but the underlying Eleventy 2.x source relies on ES2020 syntax (optional chaining, nullish coalescing) that Node 12 cannot execute natively; bypassing the engine check allows CLI startup but inevitably produces syntax errors at runtime, so a warning would not prevent failures and may mislead developers about build reliability. Using nvm to upgrade to Node 14+ or pinning Eleventy 1.x for Node 10+ environments remains the safest path, as the engine constraint is advisory and removing it permits installation while runtime incompatibility persists without transpilation.