Node.js
Status
Section titled “Status”Version: 1.0.0 | Tests: Passing
{
"features": {
"ghcr.io/infrashift/trusted-devcontainer-features/nodejs:latest": {
"target_version": "22.16.0"
}
}
} Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
target_version | string | 22.16.0 | Select a supported Node.js version |
target_checksum | string | "" | SHA256 checksum for the Node.js tarball |
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-x64.tar.xz). The Ansible playbook creates the ~/.local/share/nodejs directory, downloads the tarball for the specified version, and optionally verifies the SHA256 checksum if one is provided via the target_checksum option.
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.