TemplatesModules
Back to Modules
nodejs Icon

nodejs

By:
Install Node.js via nvm
README
Variables (5)
Scripts (1)
Source

Automatically installs Node.js via nvm. It can also install multiple versions of node and set a default version. If no options are specified, the latest version is installed.

1module "nodejs" {
2  source   = "registry.coder.com/modules/nodejs/coder"
3  version  = "1.0.10"
4  agent_id = coder_agent.example.id
5}

Install multiple versions

This installs multiple versions of Node.js:

1module "nodejs" {
2  source   = "registry.coder.com/modules/nodejs/coder"
3  version  = "1.0.10"
4  agent_id = coder_agent.example.id
5  node_versions = [
6    "18",
7    "20",
8    "node"
9  ]
10  default_node_version = "20"
11}

Full example

A example with all available options:

1module "nodejs" {
2  source             = "registry.coder.com/modules/nodejs/coder"
3  version            = "1.0.10"
4  agent_id           = coder_agent.example.id
5  nvm_version        = "v0.39.7"
6  nvm_install_prefix = "/opt/nvm"
7  node_versions = [
8    "16",
9    "18",
10    "node"
11  ]
12  default_node_version = "16"
13}