When completing a path containing `../` for `cd`, `pushd`, or `chdir`,
zsh's `_cd` runs `$(cd ${PREFIX%/*} ...)`,
which fires the `chpwd` hook in a subshell,
so `load-nvmrc` ran on each such completion, slowly in large directories.
`compstate` is set only inside completion widgets.
Checking `ZSH_SUBSHELL` instead would also skip deliberate subshells, like `( cd proj && npm test )`,
and checking it along with `WIDGET` would skip any widget's subshell, not just completion's.
Fixes#3606
903e3493 moved `$NVM_AUTH_HEADER` out of the downloader's arguments,
but a mirror URL with `user:password@` in it was still one,
so any local user could read the password in `ps` or /proc/<pid>/cmdline
for every index.tab, SHASUMS, and tarball request.
curl now gets such a URL as `url = "..."` in the config it already reads with `--config -`,
with `"` and `\` escaped;
GNU Wget reads it with `--input-file=-`,
including in the same-origin redirect loop.
A URL with whitespace or a control character cannot be one config line, and stays an argument.
BusyBox wget has no way to take a URL other than as an argument; the README says so.
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-MNDN98RD.
The zsh `load-nvmrc` and fish `load_nvm` examples passed `$(cat .nvmrc)` to `nvm version` and `nvm install`,
so a `.nvmrc` symlinked to any readable file put that file's content,
a whole one-line file with no `=` needed,
in the arguments of `find`, `sed`, and (for fish) `bass` and `bash`,
which every local user can read,
and tried to install it as a version.
Get the version from `nvm_process_nvmrc` instead, as the bash `cdnvm` example has since c314f1cb.
bass runs its arguments as bash code,
so the fish example also ran `.nvmrc` content like `v20$(touch x)`;
pass the path and version to bass in the environment instead.
Reported by Anthropic's OSS Scanner, alongside vulnerability ANT-2026-GG4I2LOU.
add CLI option --min=<version>, fallback to env var "NVM_MIN" if set.
The latter two pick the newest match,
which is below the minimum only when every match is,
so they check the resolved version.
`ls-remote` prints its notice on stderr, so the list stays parseable.
Other minor changes:
- fix: disable color in nvm_print_versions tests
- trim leading space in mock output due to eslint errors
- ensure prefixed versions like v18 also work
- remove function ref duplication
- avoid inline initialization for ksh compatibility
- apply `--min=` before checking for an empty list; require a version
Co-authored-by: ryenus <ryenus@gmail.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
The empty-computed-sum branch ended with a bare `return`,
whose status is that of the preceding `nvm_err`, which is 0.
Callers treat 0 as "verified",
so an artifact that could not be verified was installed anyway,
and was even moved into the verified cache slot,
violating nvm.sh's own invariant that only a verified archive may sit at ${TARBALL}
(a later `--offline` install would then use it without any verification).
Return 1 so the artifact is rejected, as intended by #1858.
Fixes#1858
Signed-off-by: NUAAwqy <146524024+NUAAwqy@users.noreply.github.com>
Co-authored-by: NUAAwqy <146524024+NUAAwqy@users.noreply.github.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
New Stuff
- select versions by category: `alpha`, `lts`, `non-lts`, `iojs`; exclude alphas by default
- `nvm alias`: store `--lts` and `--lts=<name>`
- record every node version's LTS status
- `nvm ls-remote`: annotate versions with the `node` alias and local aliases (#3920)
- add `nvm_has_italics`, to detect terminal italics support via terminfo
Bug Fixes
- `nvm`: treat a bare `--only` like an empty `--only=`
- `nvm_ls_remote`, `nvm_remote_version`: match dots between version components literally (#3982)
- `nvm_nvmrc_invalid_msg`: respect `--silent`
- `nvm_download`: pass `$NVM_AUTH_HEADER` to curl and GNU Wget in a config file, not as an argument
- `nvm_ls_remote_index_tab`, `nvm_remote_version`, `nvm_ls_cached`: pass the version pattern to grep with `-e`
- `nvm_die_on_prefix`: never let a project `.npmrc` choose which npmrc file `--delete-prefix` edits
- `nvm_download_artifact`: only put an archive in the cache once its checksum has passed
- `nvm_normalize_lts`, `nvm_ls_remote_index_tab`: keep untrusted text out of shell arithmetic and LTS aliases
- `nvm install`: keep nvm options after the version out of `./configure` (#3981)
- `nvm install`: apply `--alias`, `--default` and `--save` after every install (#3981)
- `nvm install`: don't leave `NVM_NO_PROGRESS` set in the caller's shell
- `nvm_get_default_packages`: ignore CRLF line endings (#3979)
- `install.sh`: ignore commented-out profile source lines (#3860)
- `nvm_print_implicit_alias`: keep `STABLE` bound, and `STABLE` and `UNSTABLE` independent of the caller (#3975)
- `nvm_ls`: treat a version dir with only hidden entries as empty (#3974)
- `ls`: list versions whose directory is a symlink (#3973)
- `nvm_die_on_prefix`: check a nonexistent prefix on Windows (#3972)
- `install.sh`: only write `$HOME` when `$NVM_DIR` is inside it (#3962)
- `nvm_is_version_or_alias`: reject uppercase LTS names in every locale
- `nvm_process_nvmrc`: don't show the content of a symlinked `.nvmrc`
- `nvm_write_nvmrc`: don't write through a symlinked `.nvmrc`
- `nvm_ls`: match `NVM_DIR` literally
- `nvm use`: do not pile up `PATH` entries in nested sessions (#3959)
- `nvm_filter_installed_versions`, `nvm_filter_lts_versions`, `nvm_record_lts_status`, `nvm_get_default_packages`: keep backslashes in `NVM_DIR` paths
- `nvm_strip_path`: preserve literal backslashes in `NVM_DIR` (#3958)
- `nvm_find_up`, `nvm_find_project_dir`: stop at a Windows drive root instead of looping forever (#3968)
- `nvm_ls_cached`: match dots in the version literally, and ignore a trailing dot (#3961)
- `install.sh`: `nvm_check_global_modules`: don't run a Windows npm under WSL (#3966)
- `nvm`: ignore option variables set by the caller
- `nvm reinstall-packages`: don't print `VERSION=''` in zsh
- `nvm_alias`, `nvm_ls_remote_index_tab`, `nvm use`: return the exit code of a failed check
- `nvm_print_versions`: don't mark `N/A` as installed
- `nvm_ls`: no blank line before `system` when nothing is installed
- `nvm_print_versions`: widen the version column for long versions
- `nvm_ls`: match a prerelease only up to a `.`
- `nvm_ls`: list every installed prerelease, in semver order
- `nvm uninstall`: only remove aliases that point at the uninstalled version
- `nvm_ls_cached`: only match whole version numbers
- `nvm debug`: don't let the shell read stdin when asked for its version
- `nvm_download`: with GNU Wget, follow only same-origin redirects when sending `$NVM_AUTH_HEADER`
- `nvm_download`: only send `$NVM_AUTH_HEADER` to URLs under a mirror it applies to
- `install.sh`: don't let a git repository in the current directory affect `git ls-remote`
- `nvm_remote_versions`: only consult io.js's version list for majors 1 through 3
- `nvm_remote_versions`: place io.js versions by major version, not at the literal `v4.0.0`
- `nvm.sh`: detect `NVM_DIR` without `$0`/`$_`; fall back to the default install location instead of the working directory
- `nvm_process_nvmrc_content`: reject control characters
- `nvm_download_artifact`, `nvm debug`: mask credentials in mirror URLs when printing them
- `nvm_install_binary`, `nvm_install_source`: only use a tarball that `nvm_download_artifact` put in the cache
- `nvm_download`, `nvm_get_latest`, `install.sh`: pass `-q` to curl first, so `.curlrc` is ignored again
- `nvm_is_version_installed`: fail when `nvm_version_path` fails
- `nvm use`, `nvm-exec`: stop option parsing at `--`
- `nvm install`: validate an inherited `NVM_MAKE_JOBS` like `-j`
- `nvm_is_natural_num`: reject anything but digits
- `nvm_remote_version`: match the requested version as a whole version component
- `install.sh`: a failed script-method download no longer clobbers the install or reports success
- `nvm_ls`: match the version pattern literally
- `bash_completion`: list alias and version names without expanding them
- `nvm_sanitize_auth_header`: strip newlines, so wrapped `base64` credentials work
- `nvm_cd`: bypass a user-defined `cd` function (#3836)
- `nvm use`: handle regex-special characters in `$NVM_DIR` (#3939)
- `install.sh`: start a new line before appending to a profile that does not end with one (#3952)
- Handle filesystem identity when checking path containment (#3921)
- `nvm alias`: do not drop output from background jobs on bash 3.2
- `nvm`: do not change or export the caller's `IFS`
- `nvm install`: do not remove the caller's `TMPDIR` after a failed download
- `nvm exec`/`nvm run`: do not treat filenames with digits as versions
Refactors
- `install.sh`: check profile lines through one comment-aware helper (#3976)
Robustness
- `nvm_nvmrc_invalid_msg`: only show an excerpt of the parsed content
- `install.sh`, `nvm uninstall`: pass the version to grep with `-e`
Performance
- `nvm_print_implicit_alias`: classify implicit aliases in one awk pass (#3980)
- `nvm_is_installed_exact_version`: also take the fast path for an exact prerelease
- `nvm_version_greater`, `nvm_version_greater_than_or_equal_to`: avoid `awk` where possible (#3949)
- `nvm_is_valid_version`, `nvm_validate_implicit_alias`: avoid forks (#3949)
- `nvm_echo`: use the `printf` shell builtin under zsh (#3949)
- `nvm_get_os`: read `/etc/os-release` instead of forking `uname -a` (#3949)
- `nvm_npmrc_bad_news_bears`: scan npmrc files without forking `grep` (#3949)
- `nvm_die_on_prefix`: detect the OS only when it is needed (#3949)
- `nvm_version`: resolve an exact, installed version without `nvm_ls` (#3949)
- `nvm_is_version_installed`: check the modern layout's path before the full lookup (#3949)
- `nvm_resolve_local_alias`: skip `nvm_version` for an exact, installed version (#3937)
- `nvm use`: skip re-resolving an exact, installed version (#3937)
Docs
- [readme] `cdnvm`: let nvm parse `.nvmrc`, so a symlinked `.nvmrc`'s content is not printed
- [readme] Fix a Docker warning from using Docker installation instructions (#3927)
- [readme] explain the misleading `npm install` error from `npm run test/fast` (#3944)
Misc
- [meta] `Makefile`: default `NVM_DIR` to the checkout when it is not set
- [meta] `release-notes.sh`: replace control characters in commit subjects
Tests
- make fast tests pass as root, without `sudo`, and without a terminal
- [actions] TOC: use `node/install` instead of `setup-node`
- pin `--lts` and `node` installs to end-of-life lines, so a new node release can't break them
- `bash_completion`: don't let zsh's `compinit` wait for an answer
- [actions] `tests-alpine`: time out jobs well before GitHub's 6-hour limit
- `nvm_download`: point the httpbin Authorization check at a configured mirror
- `nvm_get_arch_unofficial`: set `NVM_DIR` when sourcing `nvm.sh` in the chroots
- `nvm install v1 works`: get the version from `nvm_remote_version`, not the `ls-remote` display
- [actions] cache container images, verified against digests looked up live
- [actions] pull container images through Google's Docker Hub mirror
- [actions] never let an apt install wait on a prompt
- [actions] retry apt package installs through Ubuntu mirror outages
- add unit coverage for `nvm_version_greater_than_or_equal_to` (#3942)
- add unit tests for `nvm_version_greater_than_or_equal_to` (#3941)
- `nvm install --reinstall-packages-from`: mock the remote version instead of fetching it
- [actions] run the fast suite on macOS and WSL too
- make the fast suite pass on macOS
- [actions] rename `windows-npm` workflow to `windows-nvm`, since it tests `nvm install`
The bash `cdnvm` example read `.nvmrc` raw and passed its content to `nvm ls`, `nvm install`, and `nvm use`, so a `.nvmrc` symlinked to any readable file had that file's content printed in a "not found" error, bypassing the protection that `nvm_process_nvmrc` gives `nvm use`.
It now gets the version from `nvm_process_nvmrc`, which refuses a symlinked `.nvmrc` that does not contain a version or alias without showing its content, and also strips comments, which the raw read passed along.
The header was passed as a `--header` argument, so it was readable by anyone who could see the downloader's command line.
curl now reads it as `header = "…"` from a config on stdin (`--config -`); the sanitized value can contain neither `"` nor `\` nor a line break, so it cannot escape the quoted string or add another option.
GNU Wget only reads a config file that is a regular file, so a subshell writes the header to a `mktemp` file in `$TMPDIR` (mode 0600), after a copy of the user's `$WGETRC` or `~/.wgetrc`, which that file replaces, and points `WGETRC` at it;
traps on EXIT, HUP, INT, and TERM remove it, and `WGETRC` never reaches the user's shell.
BusyBox wget reads no config file and has no option for one, so it still gets the header as an argument; the README recommends curl on shared machines.
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-540RL2U6.
`nvm install --offline` installs whatever archive sits at the cache path without checking it again, which is only safe if everything nvm writes there has been verified.
When a download failed its checksum, `nvm_download_artifact` removed only the empty `files` directory and left the rejected archive in `$NVM_DIR/.cache`, so a later `nvm install --offline` would install the very tarball the online install had just refused.
An interrupted download was also left at the final cache name.
Download to a temporary `.unverified` name instead, run the 404 and checksum checks on that file, and move it to the cache path only once the checksum has passed.
Every failure path, including a checksum mismatch or a missing expected checksum, now removes the temporary file and the version's cache directory, so `--offline` no longer finds the version at all.
The README's offline section now says that only verified downloads are cached and that `--offline` trusts the cache as-is.
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-7NCT51FE.
Node 27 and later publish Alpha prereleases, like `v27.0.0-alpha.1.0.0`, in the main `index.tab`,
so `nvm install node` or `nvm install 27` would otherwise pick one.
Every version is in exactly one category: `alpha` and `lts` or `non-lts` (by index.tab's LTS column) on the node mirror, and `iojs` on the io.js mirror.
Commands select from every category but `alpha`, unless `$NVM_ONLY` lists others,
and every command that selects or lists versions takes `--only=<categories>` to override both;
an exact alpha needs `alpha` selected, like any other.
An LTS selection, like `--lts` or an `lts/` version, can't combine with an `--only=` that excludes `lts`.
Telling installed `lts` and `non-lts` versions apart uses the recorded LTS status, and fails rather than guess without it.
`nvm alias` also stores `--only=`, so `nvm alias default --only=alpha node` makes the latest installed alpha the default, including in a new shell.
`nvm alias default --lts node` writes `--lts node` to the alias file,
so it resolves to the latest installed LTS version, using each version's recorded LTS status;
`--lts=<name>` limits it to one LTS line.
The flags of the outermost alias apply when one alias points at another,
an alias with a flag this version of nvm doesn't recognize resolves to nothing, rather than ignoring the flag,
and `nvm uninstall` also removes aliases with flags that point at the uninstalled version.
A new shell never downloads index.tab, so it explains a default alias that needs LTS status that isn't recorded yet.
curl 7.58.0 and later drop a custom Authorization header when a redirect leads to another host,
but wget sends `--header` along to every redirect target,
so on a machine without curl,
a mirror that redirected elsewhere handed the credential to that other host.
When a header is sent with GNU Wget,
run it with `--max-redirect=0`.
When it then exits with 8
(an HTTP error, which includes a redirect it did not follow),
read the `Location` with one more request,
and re-request it only if it keeps the same scheme,
host, and port, up to 20 times.
A redirect to another origin,
including a downgrade to `http`,
fails with exit code 8 and an error that names the URL nvm requested and suggests curl.
`--max-redirect` is not a BusyBox wget option,
so other wgets are invoked as before;
the README says so
Discovered by Anthropic's OSS Scanner, as ANT-2026-PKUZHTT3; the scanner reported it as a vulnerability, but it is not one.
The header was added to every download,
whatever the host.
With only `$NVM_NODEJS_ORG_MIRROR` set,
a private mirror's credential therefore also went to the default `https://iojs.org/dist`
(eg, from `nvm ls-remote`),
and with only `$NVM_IOJS_ORG_MIRROR` set,
to `https://nodejs.org/dist`;
it also went to `npmjs.org` when installing an old npm.
Add `nvm_auth_header_applies_to`,
which uses `nvm_get_mirror` and accepts a URL only when it is under a mirror,
compared literally,
with a `/` after the mirror's prefix.
When exactly one of the two mirror variables is set,
the header belongs to that mirror alone;
when both or neither are set,
both mirrors
(including the defaults, when neither is)
still receive it,
so the documented example keeps working.
An invalid mirror matches nothing,
and no empty `Authorization:` header is sent when sanitizing leaves nothing
Discovered by Anthropic's OSS Scanner, as ANT-2026-YPW87EDH; the scanner reported it as a vulnerability, but it is not one.
When `nvm.sh` is sourced with `NVM_DIR` unset,
it derived `NVM_DIR` from the sourced file in bash
(via `BASH_SOURCE`),
and otherwise from `dirname "${_:-$0}"`.
In shells that do not set `BASH_SOURCE`
(dash, sh, ksh, and zsh under `emulate sh` or without `FUNCTION_ARGZERO`),
`$0` is the shell's or the calling script's name and `$_` is whatever was inherited,
so `NVM_DIR` became an unrelated directory:
for `sh -c '. ~/.nvm/nvm.sh'`,
as run by `system(3)` or `popen(3)`,
that is the working directory,
whose `alias/default` and `versions/` nvm then used,
and from which `nvm cache clear` and friends would operate.
Detection now uses only reliable sources:
`BASH_SOURCE` in bash,
`${(%):-%x}` in zsh
(which names the sourced file regardless of options),
and `${.sh.file}` in ksh93
(probed in a subshell first, since other shells with `KSH_VERSION` reject the syntax)
A detected source that is not a regular file
(eg, `/dev/fd/63` from `. <(…)`)
is ignored.
Otherwise, nvm uses the default install location that `install.sh` uses
(`$XDG_CONFIG_HOME/nvm`, else `~/.nvm`)
when it contains `nvm.sh`, and if not,
it prints an error asking for `NVM_DIR` to be set and returns 1,
instead of guessing.
Setups that export `NVM_DIR` before sourcing `nvm.sh`,
as `install.sh` and the README do, are unaffected
Discovered by Anthropic's OSS Scanner, as ANT-2026-8RIT0MGO; the scanner reported it as a vulnerability, but it is not one.
An `.nvmrc` line containing a control character
(eg, an escape, a bell, or a carriage return in the middle of the version)
was accepted as-is,
so the raw bytes were passed along as the version and printed verbatim in the "Found '…' with version <…>" and "N/A: version … is not yet installed" messages,
garbling the terminal output.
Any line that still contains a control character other than a tab,
after comments and leading and trailing white space are removed,
now makes the file invalid.
CRLF line endings keep working,
since the trailing carriage return is trimmed as white space before the check.
The "non-commented content parsed" part of the invalid `.nvmrc` message now shows each control character
(other than tabs and newlines) as `?`,
so it prints as plain text
Discovered by Anthropic's OSS Scanner, as ANT-2026-R3FR49Z7; the scanner reported it as a vulnerability, but it is not one.
`nvm_get_mirror` accepts `user:password@` in `$NVM_NODEJS_ORG_MIRROR` and `$NVM_IOJS_ORG_MIRROR`,
but `nvm_download_artifact` printed the full tarball URL in its "Downloading",
"download from ... failed",
and "HTTP 404 at URL" messages,
and `nvm debug` printed both mirror variables as-is,
so the credentials showed up in terminal output and build logs.
Add `nvm_sanitize_url`,
which replaces the userinfo part of any URL with `***@`,
and use it in those messages.
The download itself still uses the full URL,
so authenticating to the mirror keeps working.
The README now notes that `$NVM_AUTH_HEADER` is the recommended way to authenticate to a mirror
Discovered by Anthropic's OSS Scanner, as ANT-2026-X03SZ7C6; the scanner reported it as a vulnerability, but it is not one.
Fixes#2786.
Ben Younes added the alias annotations to bare `nvm ls-remote`, with their regression tests;
Jordan Harband moved `(Latest: node)` onto the newest node release, gave each kind of annotation a fixed column so the output can be sliced with `cut`, matched aliases to versions in one pass, and kept local aliases out of the mocks and tests.
Co-authored-by: Ben Younes <2910651+ousamabenyounes@users.noreply.github.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
Bug Fixes
- `nvm_alias`, `nvm_version_path`: reject `..` path components
- `nvm_get_make_jobs`: count cores on platforms the `case` does not name
- `nvm-exec`: improve the no-version failure message
- `nvm use`: do not clobber `man`'s default search path (#3890)
- `nvm_err`, `nvm_err_with_colors`: do not fail when stderr is closed (#3907)
- `nvm_hash_reset`: only run `hash -r` where the shell supports it
- `nvm_alias`: unset zsh's `extendedglob` while reading an alias file (#3891)
- zsh: restore `nomatch` and `markdirs` rather than clobbering them
- `nvm --help`: render the set-colors legend in color (#3915)
- `nvm unload`: drop the undefined `nvm_format_help_message_colors`
- `nvm_get_mirror`: allow ports, userinfo, IPv6 hosts, and percent-encoding
- `nvm_sanitize_auth_header`: allow `~`, completing RFC 7235 `token68` (#3751)
Refactors
- `nvm --help`: extract the set-colors legend into `nvm_print_color_legend`
Performance
- Optimize nvm_tree_contains_path with in-memory POSIX parent-walk (#3912)
Docs
- [readme] document platforms with no official node binaries
- `install.sh`: Fix missing words in bash/zsh completion message (#3887)
- Remove stray closing HTML tag (#3919)
Misc
- [meta] remove CLAUDE.md symlink in favor of AGENTS.md (#3928)
- [meta] add `release-notes.sh`, the release notes generator
Tests
- homebrew/actions changed their default branch
- [actions] WSL: pin every distribution, and test the newest of each line
- `nvm_print_color_legend`: look up the function with `PATH` emptied
- `nvm_print_color_legend`: check for the function, not a same-named file
- `nvm_print_color_legend`: fix the `fast` suite on GNU userlands
- [actions] `release.yml`: provide `GH_TOKEN` so release-notes PR lookup can run
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.
`man` consults its own configured search path only when MANPATH holds an empty entry;
a list without one replaces the default outright.
`nvm use` produced exactly that,
so activating a version could hide every system man page.
Contribute the empty entry as a trailing one,
so that nvm's directory keeps precedence over the system's,
and only when the list has none already,
so that repeated `nvm use` calls are idempotent and an empty entry the user placed stays where they put it.
The `$(manpath)` snapshot this replaces went stale the moment man's configuration changed,
and cost a subprocess per `nvm use`.
It was also dead: `local MANPATH` scoped the assignment to `nvm()`,
so `export` did not outlive the call and MANPATH went untouched whenever it started out unset.
Only ksh, where `local` is not a builtin, ever ran it.
`nvm deactivate` now unsets MANPATH where nvm's was the only real entry,
rather than leaving a bare `:` behind.
Reported and diagnosed by @al0ksar in #3890, which used a leading empty entry instead.
That one accrues one more colon on every `nvm use`,
which `nvm deactivate` then leaves behind,
and it loses to the system's man pages wherever nvm's bin directory is not first on PATH.
Supersedes #2077.
Refs #3890
Refs #2077
New Stuff
- `nvm install`: serialize concurrent installs of the same version
- `nvm install`: add `NVM_NO_SOURCE_FALLBACK` to disable the source fallback
Robustness
- `nvm install`: reject a structurally broken installed version
- `nvm_install_binary_extract`: replace a broken version dir atomically
- `install.sh`: `nvm_download`: avoid `eval` so arguments aren't re-parsed by the shell
Docs
- [readme] link every referenced person and project to its canonical page
Misc
- [Dev Deps] update `markdown-link-check`
Tests
- install_nvm_from_git: don't fail when master is at the latest release tag
Link the first mention of each named person to their GitHub and each named project, tool, or OS to its official homepage or repo.
Mentions that appear only inside a heading (Ansible),
an HTML comment (doctoc),
or a multi-word code span (grunt) are left unlinked,
since a link there would
break the generated table-of-contents anchors or fail to render.
Two `nvm install <same version>` runs could race on the version directory
- one removing or replacing it while the other reads or writes it.
Take a per-version advisory lock
(an atomically-created directory under $NVM_DIR/.cache locks)
around the binary/source install,
so a second run of the same version waits for the first;
installs of different versions never contend.
NVM_INSTALL_LOCK_TIMEOUT (seconds, default 600) bounds the wait,
after which nvm reports the lock path so a lock left by a killed install can be removed.
NVM_INSTALL_LOCK_STALE (minutes, default 0 / off)
opts into automatically stealing a lock older than that,
for unattended or CI use.
By default a failed binary download falls back to compiling node from source,
which is slow and pointless on platforms that always have prebuilt binaries.
`-b` already disables the fallback per-invocation;
`NVM_NO_SOURCE_FALLBACK=1` makes it the default for every `nvm install`,
so CI images and dev setups need not thread `-b` through every callsite.
It behaves exactly like `-b`
- aborting with a non-zero exit on a failed binary download
- and is mutually exclusive with `-s`, for the same reason `-b` is.
On my system, even without using local mirrors, the build is only two
minutes, even though I have only a 1 Gbps Internet connection and I'm
half-way across the world in Tokyo.
There probably are still users with much slower Internet connections
where the build could take eight minutes or more, but "several" still
covers that.
The base image is updated regularly (it's currently 22.04), and it's
easy to forget to update this readme, so best we simply not repeat
ourselves and instead let people look at `Dockerfile` to see exactly
which version of Ubuntu it's using.
The standalone `nvm reinstall-packages <version>`
command can migrate global npm packages between already-installed versions,
but it was only mentioned in `nvm --help`, not in the README.
Add a section covering it.
Refs #3858
- Help text for `nvm install`/`use`/`exec`/`run`/`which` now ends with
"Uses .nvmrc if version is omitted; otherwise errors."
so it's clear that omitting the version is not a free fallback.
- Help signatures for `use`/`exec`/`run` now show `[current | <version>]`
to mirror `nvm which` and document that `current` is accepted.
- `nvm current` description now spells out that it resolves via `$PATH`
and is not affected by `.nvmrc`.
- README: add `current` to the list of special aliases, with the same caveat.
The `.nvmrc` section now states that `nvm use`/`install`/`which`
exit with status 127 when neither a version nor an `.nvmrc` resolves,
notes the (current) `exec`/`run` fallback as undefined behavior,
and points readers at `current` for the explicit "active node" use case.
Refs #3755
Add `--offline` flag to `nvm install` that resolves versions using only locally installed versions and cached downloads. No network calls are made.
New helper functions `nvm_ls_cached` and `nvm_offline_version` scan `$NVM_DIR/.cache/bin/` for previously downloaded tarballs.
In offline mode, `nvm_download_artifact` returns cached tarballs directly without checksum verification or download attempts.
The curl/wget requirement is skipped when `--offline` is set.
Supports `--lts` via locally stored LTS alias files.
Inserted missing colons in specific parts of the text to maintain consistency with the existing format. This adjustment ensures a uniform writing style, improves readability, and aligns the text structure with the rest of the document.
New Stuff
- `install.sh`: add `$ZDOTDIR` to zsh search (#3458)
Fixes
- `reinstall-packages`: do not reinstall corepack (#3544)
- avoid bash-specific syntax (#3499)
- `install-latest-npm`: npm v11 is out
- `nvm_install_latest_npm`: avoid unbound variable (#3447)
- give a more helpful message when `lts` alias is mistakenly used (#3441)
- `nvm ls`, `nvm alias`, `nvm install`: error when an LTS name is invalid
- `nvm_normalize_lts`: error when an LTS name is not lowercase (#3417)
Documentation
- [readme] update link
- [readme] fix `--no-use` example (#3479)
- [readme] update copyright notice (#3507)
- [readme] note zsh-nvm's AUTO_USE option (#2670)
- [readme] add note about reloading zshrc after editing (#3052)
- [readme] Update shell profile file install notes (#2241)
- [readme] add docker tips (#2318)
- [readme] remove `avn` from readme (#3469)
- [readme] fnm -> nvm.fish (#2541)
Refactors
- prefer `case` over if/else chains
- combine `sed -e` invocations/arguments
Tests
- `nvm exec`/`nvm run`: add `--silent` tests (#1259)
- [actions] release test needs git tags
- migrate `installation_iojs` test suite to GitHub Actions (#3476)
- Migrate slow test suite from Travis CI (#3470)
- temporarily skip this failing travis test to unblock progress
- [actions] TOC: use latest LTS node
- `install.sh`: clean up `nvm_detect_profile` tests
- `nvm_detect_profile`: refactor (#3467)
- run urchin tests on pull requests (#3466)
- update mocks
- ensure that unit tests use only mocked LTS names
- [actions] use `node/install` instead of `node/run`
Meta
- disable blank issues
- update issue template
- add DCO (#3456)
- Rename .github/ISSUE_TEMPLATE.md to .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md (#3454)