Cloudflare Pages error with 11ty build
I have a couple of 11ty built sites that are auto deployed out to Cloudflare Pages. I normally prefer Netlify for the hosting but I do like to keep some eggs in other baskets.
I updated a site yesterday and it kept failing the deploy to Cloudflare with the error stating that Node had to be at least version 14. I checked my local Node version and it was 19.3.0. So I changed my gitignore to allow the node files to be in the deploy in the hope that this would enable Cloudflare to build out the pages correctly.(Then I had issues with Git Authentication - another post another day on this perhaps but I had to restart my Mac to get the Auth to work.) That did not work.
Turns out you have to set the Environment Variables for Node to work. This seems a bit of a faf and must be new in Cloudflare since March - the last time I deployed this site. Not sure why they have complicated things.
Navigate to Pages > site > Settings > Environment Variables and set up a new variable named NODE_VERSION and I put the version I am using in there.
And the next deployment worked!
Update 2024-09-29
On reflection this may have only happened when Cloudflare increased their minimum version of Node. Even though I was using 19.3.0 Cloudflare appears not to be detecting the version you have used, even though that is in the package.json, and relies on you setting it in the Environment Variables. This certainly does allow easy customisation but could be automated.
Next short: Stanton Coach chassis progress
Previous short: Interaction to Next Paint, the new Core Web Vital