Installs Node.js from nodejs.org, verified against the Node.js release signing keys, with Corepack in place of npm.
"features": {
"ghcr.io/bare-devcontainer/features/node:1": {}
}| Options Id | Description | Type | Default Value |
|---|---|---|---|
| version | Node.js version to install. Use "lts" for the newest long-term support release, "latest" for the newest release of any line, a release line such as "24" or "24.19", or an exact version such as "24.19.0". | string | lts |
| corepack | npm version specifier of Corepack to install globally, or "none" to leave Corepack out. | string | latest |
| keepNpm | Keep the npm and npx executables that ship with the Node.js distribution. When false, both are removed so the package manager comes from the project's "packageManager" field through Corepack. | boolean | false |
The official build from nodejs.org is unpacked into
/usr/local, Corepack is installed from npm, and npm itself is removed afterwards.
- A glibc based
linux-x64orlinux-arm64image, since that is the official build being installed. wget(orcurl),gpgv,tar,xz,sha256sumand a CA bundle, for the download, signature check and unpacking. Any of those the image is missing are installed withapt-get, so an image without them has to be Debian or Ubuntu based; an image that already has them needs no package manager at all.
The defaults install the newest long-term support release with the newest Corepack, and remove npm. To pin a release line and keep npm:
"features": {
"ghcr.io/bare-devcontainer/features/node:1": {
"version": "24",
"keepNpm": true
}
}version accepts lts (the newest long-term support release), latest (the
newest release of any line), a release line such as 24 or 24.19, or an exact
version such as 24.19.0. Everything but an exact version is resolved against
https://nodejs.org/dist/index.json at install time, so a rebuild picks up
newer patch releases.
- Node.js, unpacked into
/usr/local, owned by root. - Corepack, installed globally from npm at the version
corepackspecifies.
Corepack downloads package managers into COREPACK_HOME, which defaults to
~/.cache/node/corepack. The feature creates that directory for the remote user
so the first corepack call does not have to write into a root-owned cache.
- No npm or npx. Both are removed after Corepack is installed, so the package
manager comes from the project's
packageManagerfield rather than from the image. SetkeepNpmtotrueto keep them. - No enabled package manager. Corepack is installed but not enabled. Its shims go
into
/usr/local/bin, so enabling them needs root — aRUN corepack enablein aDockerfilelayered on the image, for instance. Without root,corepack enable --install-directorywrites them somewhere the remote user owns instead. - No package manager at all, if you ask for that:
corepack: "none"leaves Corepack out — including the copy that release lines up to Node.js 24 bundle, which is removed along with it — and combined withkeepNpm: falseyields a Node.js with nothing to install packages with. - No global JavaScript tooling. Linters, formatters and test runners are left to the project's own dependencies.
The release tarball is downloaded from https://nodejs.org/dist/ and its
checksum is verified against SHASUMS256.txt.asc, signed by the Node.js Release
Team. The keyring is vendored with the feature and read from there, so
signatures are checked against keys reviewed in this repository rather than keys
fetched at install time. It is a copy of the keyring published by
nodejs/release-keys, refreshed by this
repository's Update Trusted Material workflow.
To see the keys before pinning the feature:
gpg --no-default-keyring --keyring "$PWD/src/node/node-keyring.kbx" --list-keysEverything downloaded during installation — the tarball, the checksums and npm's cache — goes to a temporary directory that is removed when the script exits.
-
For the tags this feature is published under, see Versions and pinning.
-
If you enable npm through Corepack, keep its download cache across rebuilds by adding a named volume to
mountsindevcontainer.json, with the target set to.npmin the remote user's home directory:{ "source": "${devcontainerId}-npm-cache", "target": "/home/dev/.npm", "type": "volume" }
Note: This file was auto-generated from the devcontainer-feature.json. Add additional notes to a NOTES.md.