Skip to content
Myr

v0.40.8

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

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

authored by Jordan Harband · committed by Jordan Harband · parent 072622c · Browse files · 4 files+18 added−18 removed
This commit

State

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

Diff stats

4 files+18 added−18 removed

  • other:+18 added−18 removed

4 files+18 added−18 removed

modified:install.sh+1 added-1 removed
43 unmodified lines
44 fi45}4647nvm_latest_version() {48 nvm_echo "v0.40.7"48 nvm_echo "v0.40.8"49}5051nvm_profile_is_bash_or_zsh() {52 local TEST_PROFILE
481 unmodified lines
modified:nvm.sh+1 added-1 removed
4999 unmodified lines
5000 esac5001 NVM_VERSION_ONLY=true NVM_LTS="${NVM_LTS-}" nvm_remote_version "${PATTERN:-node}"5002 ;;5003 "--version" | "-v")5004 nvm_echo '0.40.7'5004 nvm_echo '0.40.8'5005 ;;5006 "unload")5007 nvm deactivate >/dev/null 2>&15008 unset -f nvm \
218 unmodified lines
modified:package.json+1 added-1 removed
modified:README.md+15 added-15 removed
4 unmodified lines
5 </picture>6</a>789# Node Version Manager [![Tests](https://github.com/nvm-sh/nvm/actions/workflows/tests-fast.yml/badge.svg?branch=master)][3] [![nvm version](https://img.shields.io/badge/version-v0.40.7-yellow.svg)][4] [![CII Best Practices](https://bestpractices.dev/projects/684/badge)](https://bestpractices.dev/projects/684)9# Node Version Manager [![Tests](https://github.com/nvm-sh/nvm/actions/workflows/tests-fast.yml/badge.svg?branch=master)][3] [![nvm version](https://img.shields.io/badge/version-v0.40.8-yellow.svg)][4] [![CII Best Practices](https://bestpractices.dev/projects/684/badge)](https://bestpractices.dev/projects/684)1011<!-- To update this table of contents, ensure you have run `npm install` then `npm run doctoc` -->12<!-- START doctoc generated TOC please keep comment here to allow auto update -->13<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
92 unmodified lines
106### Install & Update Script107108To **install** or **update** nvm, you should run the [install script][2]. To do that, you may either download and run the script manually, or use the following [cURL](https://curl.se) or [Wget](https://www.gnu.org/software/wget/) command:109```sh110curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash110curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash111```112```sh113wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash113wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash114```115116Running either of the above commands downloads a script and runs it. The script clones the nvm repository to `~/.nvm`, and attempts to add the source lines from the snippet below to the correct profile file (`~/.bashrc`, `~/.bash_profile`, `~/.zshrc`, or `~/.profile`). If you find the install script is updating the wrong profile file, set the `$PROFILE` env var to the profile file’s path, and then rerun the installation script.117
18 unmodified lines
136Eg: `curl ... | NVM_DIR="path/to/nvm"`. Ensure that the `NVM_DIR` does not contain a trailing slash.137138- The installer can use [`git`](https://git-scm.com/), `curl`, or `wget` to download `nvm`, whichever is available.139140- You can instruct the installer to not edit your shell config (for example if you already get completions via a [zsh nvm plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/nvm)) by setting `PROFILE=/dev/null` before running the `install.sh` script. Here's an example one-line command to do that: `PROFILE=/dev/null bash -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash'`140- You can instruct the installer to not edit your shell config (for example if you already get completions via a [zsh nvm plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/nvm)) by setting `PROFILE=/dev/null` before running the `install.sh` script. Here's an example one-line command to do that: `PROFILE=/dev/null bash -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash'`141142#### Installing in Docker143144When invoking bash as a non-interactive shell, like in a [Docker](https://www.docker.com) container, none of the regular profile files are sourced. In order to use `nvm`, `node`, and [`npm`](https://www.npmjs.com) like normal, you can instead specify the special `BASH_ENV` variable, which bash sources when invoked non-interactively.
7 unmodified lines
152RUN touch "${BASH_ENV}"153RUN echo '. "${BASH_ENV}"' >> ~/.bashrc154155# Download and install nvm156RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | PROFILE="${BASH_ENV}" bash156RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | PROFILE="${BASH_ENV}" bash157RUN echo node > .nvmrc158RUN nvm install159```160
9 unmodified lines
170# install curl171RUN apt update && apt install curl -y172173# install nvm174RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash174RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash175176# set env177ENV NVM_DIR=/root/.nvm178
17 unmodified lines
196```197docker run --rm -it nvmimage198199root@0a6b5a237c14:/# nvm -v2000.40.72000.40.8201202root@0a6b5a237c14:/# node -v203v19.9.0204
54 unmodified lines
259260```yaml261- name: Install nvm262 ansible.builtin.shell: >263 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash263 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash264 args:265 creates: "{{ ansible_env.HOME }}/.nvm/nvm.sh"266```267
53 unmodified lines
321If you have `git` installed (requires git v1.7.10+):3223231. clone this repo in the root of your user profile324 - `cd ~/` from anywhere then `git clone https://github.com/nvm-sh/nvm.git .nvm`3251. `cd ~/.nvm` and check out the latest version with `git checkout v0.40.7`3251. `cd ~/.nvm` and check out the latest version with `git checkout v0.40.8`3261. activate `nvm` by sourcing it from your shell: `. ./nvm.sh`327328Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login:329(you may have to add to more than one of the above files)
663 unmodified lines
993994### Alpine Linux 3.13+995```sh996apk add -U curl bash ca-certificates openssl ncurses coreutils python3 make gcc g++ libgcc linux-headers grep util-linux binutils findutils997curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash997curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash998```9991000### Alpine Linux 3.5 - 3.121001```sh1002apk add -U curl bash ca-certificates openssl ncurses coreutils python2 make gcc g++ libgcc linux-headers grep util-linux binutils findutils1003curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash1003curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash1004```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._1007
91 unmodified lines
10991100To change the user directory and/or account name follow the instructions [here](https://support.apple.com/en-us/HT201548)11011102[1]: https://github.com/nvm-sh/nvm.git1103[2]: https://github.com/nvm-sh/nvm/blob/v0.40.7/install.sh1103[2]: https://github.com/nvm-sh/nvm/blob/v0.40.8/install.sh1104[3]: https://github.com/nvm-sh/nvm/actions/workflows/tests-fast.yml1105[4]: https://github.com/nvm-sh/nvm/releases/tag/v0.40.71105[4]: https://github.com/nvm-sh/nvm/releases/tag/v0.40.81106[Urchin]: https://git.sdf.org/tlevine/urchin1107[Fish]: https://fishshell.com11081109**Homebrew makes zsh directories insecure**
76 unmodified lines
11861187If you've encountered this error on WSL-2:11881189 ```sh1190 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash1190 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash1191 % Total % Received % Xferd Average Speed Time Time Time Current1192 Dload Upload Total Spent Left Speed1193 0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0curl: (6) Could not resolve host: raw.githubusercontent.com1194 ```
26 unmodified lines
1221Currently, the sole maintainer is [@ljharb](https://github.com/ljharb) - more maintainers are quite welcome, and we hope to add folks to the team over time. [Governance](./GOVERNANCE.md) will be re-evaluated as the project evolves.12221223## Project Support12241225Only the latest version (v0.40.7 at this time) is supported.1225Only the latest version (v0.40.8 at this time) is supported.12261227## Enterprise Support12281229If you are unable to update to the latest version of `nvm`, our [partners](https://openjsf.org/ecosystem-sustainability-program) provide commercial security fixes for all unsupported versions:
15 unmodified lines