Skip to content

Node.js

Version: 1.0.0 | Tests: Passing

devcontainer.json
{
    "features": {
        "ghcr.io/infrashift/trusted-devcontainer-features/nodejs:latest": {
            "target_version": "22.16.0"
        }
    }
}
OptionTypeDefaultDescription
target_versionstring22.16.0Select a supported Node.js version
target_checksumstring""SHA256 checksum for the Node.js tarball

None — this feature is independent and has no dependencies.

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.