11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
16.83k stars 487 forks source link

Netlify deploys fail while local builds succeed #1557

Closed dandenney closed 1 month ago

dandenney commented 3 years ago

Describe the bug While this is technically a Netlify issue, a little birdie mentioned that it might be good for searching in here. Netlify deploys started failing with no build flow changes. The error indicates a problem with Eleventy, but the reality is that it's a Node version mismatch.

8:20:17 AM: `EleventyConfigError` was thrown
8:20:17 AM: 2020-12-10T14:20:17.406Z Eleventy:EleventyErrorHandler (error stack): EleventyConfigError: Error in your Eleventy config file '/opt/build/repo/.eleventy.js'.

To Reproduce

  1. Deploy Eleventy on Netlify without setting the Node version in some way.
  2. Have a dependency, Eleventy or otherwise, that uses a newer Node version with a breaking change

Expected behavior Expected is a stretch a little bit here, but my expectation was that Netlify would be running the same Node version that I was running for my local build.

Solution Set your Node version in some way, based on Netlify's recommendations: https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript

A .nvmrc was the quickest and most straight forward solution I found for parity between the two.

Additional context Full error list on the Netlify Community: https://community.netlify.com/t/eleventy-deployment-failures/28064

zachleat commented 3 years ago

I think the other thing to note (fwiw, and perhaps unbeknownst to a fair number of people) is that odd numbers of Node are a bit special. Rule of thumb is that I try to stick to even numbered major versions of Node

You can read more here: https://tamalweb.com/which-nodejs-version

There is also this suggestion on the Node download page:

image

zachleat commented 1 month ago

I see the :tada: emoji here @dandenney—can we close this old one? 😅

dandenney commented 1 month ago

@zachleat Yessir, thank you!