Node.js
Status
Section titled “Status”Version: 1.6.0 | Tests: Passing
{
"features": {
"ghcr.io/infrashift/trusted-devcontainer-features/nodejs:latest": {
"target_version": "22.23.4",
"npm_version": "12.2.1"
}
}
} Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
target_version | string | 22.23.4 | Select a supported Node.js version |
target_checksum | string | "" | SHA256 checksum for the Node.js tarball |
npm_version | string | 12.2.1 | npm version installed over the copy bundled with Node.js |
Dependencies
Section titled “Dependencies”None — this feature is independent and has no dependencies.
How It Works
Section titled “How It Works”This feature downloads the official Node.js binary distribution from nodejs.org as a tarball (node-v<version>-linux-<arch>.tar.xz). The Ansible playbook creates the ~/.local/share/nodejs directory, downloads the tarball for the specified version, and verifies the SHA256 checksum against the pinned per-architecture digest, or against an explicit target_checksum if one is provided.
Once verified, the tarball is extracted into ~/.local/share/nodejs, and the Node.js bin directory is added to PATH. This provides both the node runtime and the bundled npm package manager immediately after installation.
If you need a different npm version than what ships with the installed Node.js release, combine this feature with the npm feature. The npm feature declares nodejs as a dependency, so including it will automatically trigger Node.js installation first and then upgrade npm to the specified version. This two-feature approach gives you independent control over both the Node.js runtime version and the npm version.