Skip to content
Myr

[readme] document platforms with no official node binaries

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The README never said which platforms nvm can detect but nodejs.org does not build for, so a user on one of them only finds out from a slow, silent, source-build fallback. Also corrects the Alpine section: nvm remaps Alpine to a musl arch itself now, and nodejs.org has published `linux-x64-musl` since v24.20.0, so both the "no concrete plans" and the "does not exist errors" claims are out of date. Coverage bounds are stated per release line rather than per patch, since the newest of them are still shipping.

authored by Jordan Harband · committed by Jordan Harband · parent b6d7823 · Browse files · 1 file+30 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+30 added−2 removed

  • other:+30 added−2 removed

1 file+30 added−2 removed

modified:README.md+30 added-2 removed
42 unmodified lines
43 - [Restoring PATH](#restoring-path)44 - [Set default node version](#set-default-node-version)45 - [Use a mirror of node binaries](#use-a-mirror-of-node-binaries)46 - [Pass Authorization header to mirror](#pass-authorization-header-to-mirror)47 - [Platforms without official binaries](#platforms-without-official-binaries)48 - [.nvmrc](#nvmrc)49 - [Deeper Shell Integration](#deeper-shell-integration)50 - [Calling `nvm use` automatically in a directory with a `.nvmrc` file](#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file)51 - [bash](#bash)
594 unmodified lines
646647NVM_IOJS_ORG_MIRROR=https://iojs.org/dist nvm install iojs-v1.0.3648```649650Some platforms and architectures have no binary on the default host at all; see [Platforms without official binaries](#platforms-without-official-binaries).651652`nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs. Note that using `nvm` in multiple shell tabs with this environment variable enabled can cause race conditions.653654#### Pass Authorization header to mirror655To pass an Authorization header through to the mirror url, set `$NVM_AUTH_HEADER`
1 unmodified line
657```sh658NVM_AUTH_HEADER="Bearer secret-token" nvm install node659```660661### Platforms without official binaries662663nodejs.org does not publish a binary for every platform and architecture nvm can detect. Where it does not, `nvm install` falls back by default to compiling from source, which is slow and needs a C++ toolchain (see [Important Notes](#important-notes)); set `$NVM_NO_SOURCE_FALLBACK` to `1` to make a missing binary an error instead.664665[unofficial-builds.nodejs.org](https://unofficial-builds.nodejs.org/download/release/) ([nodejs/unofficial-builds](https://github.com/nodejs/unofficial-builds)) publishes binaries for platforms the Node.js project does not officially support. To use them, point [`$NVM_NODEJS_ORG_MIRROR`](#use-a-mirror-of-node-binaries) at it:666667```sh668export NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release669```670671| platform | binaries on nodejs.org | binaries on unofficial-builds |672| --- | --- | --- |673| `freebsd`, `openbsd` (any arch) | none | none |674| `sunos` (Solaris, illumos) | v13.x and earlier | none |675| `linux-x86` (32-bit) | v9.x and earlier | v8.16.0 through v21.x |676| `linux-armv6l` | v11.x and earlier | v8.16.0 through v22.x |677| `linux-armv7l` | v23.x and earlier | none |678| `linux-x64-musl` (Alpine) | v24.20.0+ and v26.8.0+ only | v8.16.0 and later |679| `linux-arm64-musl` (Alpine) | none | v20.20.1 and later |680| `linux-loong64` | none | v18.18.0 and later |681| `linux-riscv64` | none | v17.7.1 through v26.0.0 |682| `win-x86` (32-bit) | v22.x and earlier | none |683684Neither host is gapless, and both change over time; the `index.tab` at the root of each is authoritative. Where neither has a binary, `nvm install` compiles from source, except on non-WSL Windows, which nvm cannot build on; on FreeBSD and OpenBSD it skips the download and goes straight to source. Alpine has its own section: [Installing nvm on Alpine Linux](#installing-nvm-on-alpine-linux).685686### .nvmrc687688You can create a `.nvmrc` file containing a node version number (or any other string that `nvm` understands; see `nvm --help` for details) in the project root directory (or any parent directory).689Afterwards, `nvm use`, `nvm install`, and `nvm which` will use the version specified in the `.nvmrc` file if no version is supplied on the command line; if no `.nvmrc` is found either, they exit with status `127`. (`nvm exec` and `nvm run` follow the same `.nvmrc` lookup, but currently fall back to the active node if neither resolves — treat that fallback as undefined behavior; pass an explicit version if you need predictable scripting.) If you want the currently active version, pass `current` explicitly (e.g. `nvm which current`) — `current` is not affected by `.nvmrc`.
294 unmodified lines
984## Installing nvm on Alpine Linux985986In order to provide the best performance (and other optimizations), nvm will download and install pre-compiled binaries for Node (and npm) when you run `nvm install X`. The Node project compiles, tests and hosts/provides these pre-compiled binaries which are built for mainstream/traditional Linux distributions (such as Debian, Ubuntu, [CentOS](https://www.centos.org), [RedHat](https://www.redhat.com) et al).987960[Alpine Linux](https://www.alpinelinux.org), unlike mainstream/traditional Linux distributions, is based on [BusyBox](https://www.busybox.net/), a very compact (~5MB) Linux distribution. BusyBox (and thus Alpine Linux) uses a different C/C++ stack to most mainstream/traditional Linux distributions - [musl](https://www.musl-libc.org/). This makes binary programs built for such mainstream/traditional incompatible with Alpine Linux, thus we cannot simply `nvm install X` on Alpine Linux and expect the downloaded binary to run correctly - you'll likely see "...does not exist" errors if you try that.988[Alpine Linux](https://www.alpinelinux.org), unlike mainstream/traditional Linux distributions, is based on [BusyBox](https://www.busybox.net/), a very compact (~5MB) Linux distribution. BusyBox (and thus Alpine Linux) uses a different C/C++ stack to most mainstream/traditional Linux distributions - [musl](https://www.musl-libc.org/). This makes binary programs built for such mainstream/traditional distributions incompatible with Alpine Linux, so on `x64` and `arm64` nvm requests a `musl` build instead. nodejs.org publishes those only for some recent `x64` releases, so for anything else the download 404s and `nvm install X` falls back to compiling from source, unless you point it at a mirror that has one (see [Platforms without official binaries](#platforms-without-official-binaries)).989990There is a `-s` flag for `nvm install` which requests nvm download Node source and compile it locally.991992If installing nvm on Alpine Linux *is* still what you want or need to do, you should be able to achieve this by running the following from your Alpine Linux shell, depending on which version you are using:
11 unmodified lines
1004```10051006_Note: Alpine 3.5 can only install NodeJS versions up to v6.9.5, Alpine 3.6 can only install versions up to v6.10.3, Alpine 3.7 installs versions up to v8.9.3, Alpine 3.8 installs versions up to v8.14.0, Alpine 3.9 installs versions up to v10.19.0, Alpine 3.10 installs versions up to v10.24.1, Alpine 3.11 installs versions up to v12.22.6, Alpine 3.12 installs versions up to v12.22.12, Alpine 3.13 & 3.14 install versions up to v14.20.0, Alpine 3.15 & 3.16 install versions up to v16.16.0 (**These are all versions on the main branch**). Alpine 3.5 - 3.12 required the package [`python2`](https://www.python.org/) to build NodeJS, as they are older versions to build. Alpine 3.13+ requires `python3` to successfully build newer NodeJS versions, but you can use `python2` with Alpine 3.13+ if you need to build versions of node supported in Alpine 3.5 - 3.15, you just need to specify what version of NodeJS you need to install in the package install script._1007980The Node project has some desire but no concrete plans (due to the overheads of building, testing and support) to offer Alpine-compatible binaries.1008The Node project now publishes an official `linux-x64-musl` binary for some recent releases (v24.20.0+ and v26.8.0+; no v25 release has one). There is no official `arm64` musl binary.10091010As a potential alternative, [@mhart](https://github.com/mhart) (a Node contributor) has some [Docker images for Alpine Linux with Node and optionally, npm, pre-installed](https://github.com/mhart/alpine-node).10111012<a id="removal"></a>
232 unmodified lines