Managing your Node.js version with nvm

Last modified: February 15th, 2024

Working with a specific static site generator?
Customize CloudCannon's documentation to suit your SSG.

Great! We'll show you documentation relevant to .
You can change this any time using the dropdown in the navigation bar.

CloudCannon uses the LTS (18.19.0) version of Node.js by default. You can use nvm to select which node version to use with your build.

The following Node.js versions are pre-installed:

  • 10.24.1
  • 12.22.12
  • 14.21.3
  • 15.14.0
  • 16.20.2
  • 18.19.0 (default)
  • 20.11.0

Each Node.js version has the following packages preinstalled globally:

Usage#

Select which nvm version to use in your preinstall script:

.cloudcannon/preinstall
copied
nvm use v14.18.3

Or install and use a custom version:

.cloudcannon/preinstall
copied
nvm install v17.5.0
nvm use v17.5.0

.nvmrc#

Add a .nvmrc to your site's root directory to specify which node version to use. For example:

.nvmrc
copied
v12.22.9

Then in your preinstall script:

.cloudcannon/preinstall
copied
nvm use

Using alternative package managers#

CloudCannon has npm and yarn pre-installed. Other package managers such as pnpm are not installed by default.

You can use /.cloudcannon/preinstall to add pnpm or another package managers to your build/install commands. For more information, please read our documentation on build hooks.

Related links

Open in a new tab