Skip to content

Build image

Cloudflare Pages’ build environment has broad support for a variety of languages, such as Ruby, Node.js, Python, PHP, and Go.

If you need to use a specific version of a language, (for example, Node.js or Ruby) you can specify it by providing an associated environment variable in your build configuration, or setting the relevant file in your source code.

Supported languages and tools

In the following tables, review the preinstalled versions for languages and tools included in the Cloudflare Pages’ build image, and the environment variables and/or files available for overriding the preinstalled version:

Languages and runtime

Tool Default version Supported versions Environment variable File
Go 1.21.0 Any version GO_VERSION
Node.js 18.17.1 Any version NODE_VERSION .nvmrc, .node-version
Python 3.11.5 Any version PYTHON_VERSION .python-version, runtime.txt
Ruby 3.2.2 Any version RUBY_VERSION .ruby-version

Tools

Tool Default version Supported versions Environment variable
Bundler 2.4.10 Corresponds with Ruby version
Embedded Dart Sass 1.62.1 Up to 1.62.1 EMBEDDED_DART_SASS_VERSION
gem 3.4.10 Corresponds with Ruby version
Hugo 0.118.2 Any version HUGO_VERSION
npm 9.6.7 Corresponds with Node.js version
pip 23.2.1 Corresponds with Python version
pipx 1.2.0
pnpm 8.7.1 Any version PNPM_VERSION
Poetry 1.6.1
Yarn 3.6.3 Any version YARN_VERSION
Bun 1.1.33 Any version BUN_VERSION

Frameworks

To use a specific version of a framework, specify it in the project’s package manager configuration file. For example, if you use Gatsby, your package.json should include the following:

"dependencies": {
"gatsby": "^5.13.7",
}

When your build starts, if not already cached, version 5.13.7 of Gatsby will be installed using npm install.

Overriding default versions

To override default versions of languages and tools in the build system, you can either set the desired version through environment variables or by adding files to your project.

To set the version using environment variables, you can:

  1. Find the environment variable name for the language or tool in this table.
  2. Add the environment variable on the dashboard by going to Settings > Environmnet variables in your Pages project, or add the environment variable via Wrangler.

Or, to set the version by adding a file to your project, you can:

  1. Find the file name for the language or tool in this table.
  2. Add the specified file name to the root directory of your project, and add the desired version number as the contents of the file.

For example, if you were previously relying on the default version of Node.js in the v1 build system, to migrate to v2, you must specify that you need Node.js 12.18.0 by setting a NODE_VERSION = 12.18.0 environment variable or by adding a .node-version or .nvmrc file to your project with 12.18.0 added as the contents to the file.

V2 build system

The v2 build system announced in May 2023 brings several improvements to project builds.

V1 to V2 Migration

To migrate to this new version, configure your Pages project settings in the dashboard:

  1. Log in to the Cloudflare dashboard and select your account.
  2. Select Workers & Pages > in Overview, select your Pages project.
  3. Go to Settings > Build & deployments > Build system version and select the latest version.

If you were previously relying on the default versions of any languages or tools in the build system, your build may fail when migrating to v2. To fix this, you must specify the version you wish to use by overriding the default versions.

Limitations

Here are some limitations with the v2 build system:

  • Specifying Node.js versions as codenames (for example, hydrogen or lts/hydrogen).
  • Detecting Yarn version from yarn.lock file version.
  • Detecting pnpm version detection based pnpm-lock.yaml file version.
  • Detecting Node.js and package managers from package.json -> "engines".
  • pipenv and Pipfile support.

Build environment

Cloudflare Pages builds are run in a gVisor container.

Build environment

Ubuntu 22.04.2

Architecture x86_64