If you simply connect a website’s code on GitHub with Cloudflare Pages that’s built using Next.js 15+, it may not build successfully out of the box. If this is the case with you, make sure to do the following.
Create a new .nvmrc
file at the root of your project with this in it:
20
Yes, it’s just the number 20. This specifies the node version to use.
Additionally, add the following to your package.json
file:
"engines": {
"node": ">=20.0.0"
}
That’s all you have to do. You do not have to change any commands on Cloudflare, etc. I built the website for SimpleFill using Next.js 15 and have deployed to Cloudflare Pages currently with no issues whatsoever.