# nodejs

> For the complete documentation index, see [llms.txt](https://docs.ringleader.dev/llms.txt).


> Node.js and npm, installed from the upstream apt repository on Debian and Ubuntu.


Installs Node.js and npm.

```yaml
devtools:
  - name: nodejs
```

With no `version`, you get the current Active LTS release (Node 24) on Debian and
Ubuntu, and the distribution's own Node on Alpine. That is all most people need. Declare
`nodejs` before `claude-code`, `codex` or `playwright` so they build on it.

## Major versions

On Debian and Ubuntu, Node always comes from the upstream Node.js repository; `version`
chooses which major.

| `version` | Debian / Ubuntu | Alpine |
|-----------|-----------------|--------|
| omitted | the upstream repository for the **current Active LTS major** (Node **24**) | the distribution's `nodejs` and `npm` packages |
| `24`, `24.5.0`, `v24` | the upstream repository for that **major** (24) | **refused**, with a message saying to drop the `version` |
| `latest`, `lts` | no major to pin, so the Active LTS major again | the distribution packages |

Only the leading integer is used, so `24`, `24.5.0` and `v24` all select the Node 24
repository. The upstream package bundles npm.

Changing `version` does not move a workstation that already has Node. Node arrives as a
package, and a package that is already installed is left alone, so the new major reaches
only workstations that do not have Node yet.

When the workstation's Node.js major changes, Ringleader rebuilds each `npm`
package (see [package installation](https://docs.ringleader.dev/workstations/packages-tools-settings/package-installation/)) for the
new major at the version it has.

Debian and Ubuntu's own `nodejs` package is not used because it stays on the major it
shipped with for the life of the release (Debian 13 has Node 20), and the npm-based
tools you are likely to install, such as Claude Code, Codex and Playwright, expect a
current one.

## Updates

Node.js comes from the upstream repository for its major on Debian and Ubuntu, and from Alpine's
packages on Alpine. It moves with the
[operating system updates](https://docs.ringleader.dev/reference/tools/devtools/#operating-system-updates) the workstation applies.
On Debian and Ubuntu, it stays within its major. When Node.js moves, the workstation
reinstalls your `npm` packages, and the devtools that install from npm, at the versions they
already have. [Update routes](https://docs.ringleader.dev/reference/tools/devtools/#update-routes) describes this.

## Node.js for coding agents

The `claude-code`, `codex` and `opencode` devtools install with npm, so they need Node.js. If
you declare `nodejs`, those devtools use it, and Ringleader installs it before them. Otherwise
the recipe installs the distribution's Node.js and npm, but only on a workstation with no `npm`.

A configuration that also declares `npm` [packages](https://docs.ringleader.dev/workstations/packages-tools-settings/package-installation/#language-toolchains)
changes that on a workstation with no npm. With no `node` either, Ringleader adds this devtool,
so on Debian and Ubuntu the agent runs on Node 24. With `node` already present, it adds the
distribution's `npm` package instead. Declare `nodejs` explicitly when you care which version an
agent runs on.

The [`pi` devtool](https://docs.ringleader.dev/reference/tools/devtools/pi/#nodejs) needs Node.js 22.19 or newer and
installs one for itself. [`cursor-agent`](https://docs.ringleader.dev/reference/tools/devtools/cursor-agent/) brings
its own Node.js runtime, and [`agy`](https://docs.ringleader.dev/reference/tools/devtools/agy/) needs none.

## Automatic installation

A config that declares `npm` packages needs npm. When the workstation has no `npm` and no
config declares `nodejs`, Ringleader adds this devtool with no `version`, so a new Debian
or Ubuntu workstation gets Node 24 and a new Alpine one gets the distribution's Node.js.
A workstation that has `node` but no `npm` gets the distribution's `npm` package instead.

A workstation that already has npm keeps its Node.js, whatever the config declares for
`npm` packages. Two workstations with one config can therefore run different majors until
the config declares `nodejs`. Declare it with a `version` to make them agree. A devtool
you declare always wins.

## Example

A project whose test runner needs a newer built-in module pins Node 24 explicitly, so
the choice is visible in the manifest:

```yaml
devtools:
  - name: nodejs
    version: "24"
  - name: claude-code    # npm install -g, on the Node 24 above
  - name: codex
```

## Notes

- `claude-code`, `codex` and `playwright` all need npm, and each will install
  Node.js itself if none is present. Declaring `nodejs` first, before those entries,
  is what pins the version they build against.
- A versionless `nodejs` works on Debian, Ubuntu and Alpine. Pinning a **major**
  requires Debian or Ubuntu: the upstream repository publishes no musl build, so on
  Alpine a pinned version is refused with a message.
- The workstation is considered to have this devtool once `npm` resolves on PATH.

