Loading...

How to run a website built with Next.js 15 on Cloudflare Pages?

question nextjs cloudflare
Ram Patra Published on March 19, 2025
Next.js 15+

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.

Take your presentation to the next level.

Put your face and name on your screen.

Your to-dos on your menu bar.

Fill forms using your right-click menu.

Ram Patra Published on March 19, 2025
Image placeholder

Keep reading

If this article was helpful, others might be too

question nextjs react July 9, 2024 How to create global types in Typescript in a Next.js app?

The env.d.ts file is typically used for global type declarations, especially for environment variables and other globally available types. This file is automatically included in the TypeScript compilation if it’s referenced in tsconfig.json.

question eslint nextjs November 14, 2024 How to disable ESLint in a Nextjs project?

Although it is highly advisable to enable ESLint at all times, if you do not want ESLint to run during next build, you can set the eslint.ignoreDuringBuilds option in next.config.js to true like below:

question nextjs react July 9, 2024 How to define an enum in Typescript and use it in a Next.js app?

Creating an enum in TypeScript within a Next.js project is straightforward. Enums in TypeScript allow you to define a set of named constants that can be used to represent a collection of related values. Here’s how you can create and use an enum in a Next.js application:

Like my work?

Please, feel free to reach out. I would be more than happy to chat.