Managing your Node.js version with nvm

Last modified: June 1st, 2023

CloudCannon uses the LTS (18.13.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.0
  • 18.13.0 (default)
  • 18.16.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.sh
copied
nvm use

Related links

Open in a new tab