Solved: Cloudflare Pages with a Next.JS static site returning error [email protected]: The engine 'node' is incompatible with this module

I'm currently in the process to shift my blog from a WordPress website to a blog generate using a static generated website built with Next.js and hosted on Cloudflare Pages.

During the initial setup of my Next.js site on Cloudflare Pages, I encountered an error message that stated:

"error [email protected]: The engine 'node' is incompatible with this module. Expected version '^12.22.0 || ^14.17.0 || >=16.0.0'. Got '12.18.0'." This error indicated a version mismatch between the required Node.js version and the one installed on the Cloudflare Pages build environment.

The error is indicating that the version of node being used during the build process is not matching the version required by eslint. Cloudflare pages allows you to define environment variables which control your build process. Luckily Cloudflare support an environment variable which controls which version of Node is installed.

To solve the problem, I needed to add an environment variable named NODE_VERSION and setting its value to 18. This solved the build process issue and now my development version of the website is being deployed correctly.


Published in: Blogging, Troubleshooting