What steps are involved in updating the Node.js version for a Vite build on Cloudflare Pages?

Responsive Ad Header

Question

Grade: Education Subject: Support
What steps are involved in updating the Node.js version for a Vite build on Cloudflare Pages?
Asked by:
93 Viewed 93 Answers

Answer (93)

Best Answer
(455)
Cloudflare Pages uses a default Node.js version, but you can specify a different one for your build. To update the Node.js version, you should add an `.nvmrc` file to the root of your Vite project (e.g., `18.17.1`) or specify the `engines` field in your `package.json` (e.g., `"engines": { "node": "18" }`). Cloudflare Pages will detect this file during the build process and use the specified Node.js version, ensuring compatibility with your Vite setup.