Mindket

nvm

Newversion 2 · updated
Star96k

Overview

nvm-sh’s free shell script that installs several versions of Node.js side by side and switches between them in each shell. The setup notes cover Linux, macOS, Windows through WSL, Docker, Alpine and .nvmrc files.

nvm is an open-source project on GitHub in the Developer category, listed by Mindket. It is free. This is version 2, last updated on . Install it from GitHub as its README says. Get Mindket’s setup notes on your Mindket account, as a zip.

At a glance

Runs in
  • Linux: the install script with curl or wget, or a Git install
  • macOS: the same script, after the Xcode command line tools are installed
  • Windows: through WSL, and the README says it should also work in Git Bash or Cygwin
  • Docker and CI jobs: set BASH_ENV, or use the README’s Dockerfile for CI/CD jobs
Start with
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash

Platform

LinuxOperating system
macOSOperating system
WindowsOperating system
DockerContainer

About

What it is

nvm is a version manager for Node.js. It is a shell script that you install per user and run per shell, so each terminal can use a different Node.js version without touching a system copy. The README says it works on any POSIX-compliant shell (sh, dash, ksh, zsh and bash), on unix, macOS and Windows WSL.

  1. The install script adds nvm to ~/.nvm and your profile
  2. nvm install 22 fetches that version of Node.js
  3. nvm use 22 points this shell’s PATH at it
  4. A .nvmrc file names the version a project needs
  5. nvm use with no version reads that file

Who it suits

Developers who work on several Node.js projects and need a different version in each. Maintainers who test a library on an old and a new Node.js get the same help, and so do people who build Docker images or CI jobs. Skip it on Windows outside WSL, Git Bash and Cygwin. For that the README points to nvm-windows, nodist and nvs, which it says the nvm team neither supports nor develops.

Who uses it, and how
IndustryWho uses itHow they use itExample
Web developmentDevelopers with several Node.js projectsInstall each project’s version and switch with a .nvmrc fileA developer runs nvm use inside a project folder, and the shell switches to the version its .nvmrc names.
Open source librariesMaintainers who support more than one Node.js versionRun one command under different versions with nvm execA maintainer runs nvm exec 4.2 node --version, as the README does, then repeats it with another version.
DevOps and CIEngineers who build images and CI jobsInstall nvm in a Dockerfile and pass the Node.js version as a build argumentAn engineer builds the README’s CI Dockerfile with --build-arg NODE_VERSION=19 and gets an image on that version.
Support and QAPeople who reproduce a bug on the reporter’s versionInstall the exact version beside the current one and run the failing command thereA tester installs 14.7.0 with nvm install 14.7.0, runs the failing script under it, then switches back.

Where to use it

nvm runs in a POSIX-compliant shell on the platforms below, and the setup notes have a page for each of them, with the commands copied from the maker’s README.

  • Linux: the install script with curl or wget, or a Git install
  • macOS: the same script, after the Xcode command line tools are installed
  • Windows: through WSL, and the README says it should also work in Git Bash or Cygwin
  • Docker and CI jobs: set BASH_ENV, or use the README’s Dockerfile for CI/CD jobs
  • Alpine Linux: extra packages first, and a source build when no musl binary exists
  • Shells: sh, dash, ksh, zsh and bash. fish is not supported, and the README lists alternatives made by others

How to set it up

Get it saves a zip of Mindket’s setup notes in your downloads folder, with a page for each platform from the maker’s README. The install script does most of the work.

What you need first
NeedDetail
bashThe install script runs only under bash (install.sh exits otherwise). Once installed, nvm runs in sh, dash, ksh, zsh or bash
curl, wget or gitThe README says the installer uses whichever is available, and that git must be v1.7.10 or newer
A shell profile file~/.bashrc, ~/.bash_profile, ~/.zshrc or ~/.profile. On a Mac the file may not exist yet, and the README says to create it with touch
A C++ compilerOnly when a version has no binary for your system and nvm builds it from source
An account or keyThe README’s install steps ask for none
  1. Run the install script with curl or wget.
  2. Close the terminal and open a new one, or source your profile file.
  3. Run command -v nvm, which should print nvm.
  4. Install a Node.js version with nvm install.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash

The command names v0.40.8, the release the README named when these notes were written. Use the one it shows now. The script puts nvm in ~/.nvm, with git if you have it and a download if not, and adds the source lines to the profile file it finds. If it picks the wrong file, set the PROFILE variable to the right path and run it again.

command -v nvm

How to use it

Install a version, switch to it and set the default for new shells. The README says the first version you install becomes the default.

nvm install node
nvm install 14.7.0
nvm use node
nvm ls
nvm alias default node

The first line installs the latest release and the second installs that exact one, so a current copy and an older one can sit side by side on the same machine. Running nvm use changes PATH in the shell you run it in, and nvm ls lists what you have. A new shell starts on the default alias. For a project, put the version in a .nvmrc file. Then nvm use with no version reads it, and so do nvm install and nvm which.

Example

You have projects on Node.js 24, 22 and 20. This is the README’s first example. nvm use switches only to versions you have already installed, so 22 and 20 must be there first:

nvm install 24
node -v
nvm use 22
node -v
nvm use 20
node -v

Each node -v prints the version you just switched to. The README’s sample output also shows a Now using node line, with the node and npm versions, after each install and use.

For newcomers and experts

If you are new. A project can need a different Node.js than the one on your machine. nvm keeps each version in its own folder under ~/.nvm and changes which one your shell finds first. The nvm command is a function your shell loads, not a program on your PATH, so, as the README says, which nvm will not work. Use command -v nvm instead. Close the terminal after installing and open a new one. Until then the command may be missing. The README says that with nvm you do not need sudo to install a module globally with npm -g.

For experts. The special aliases (node, iojs, stable, unstable, current) work with nvm install, nvm use, nvm run, nvm exec and nvm which. LTS names (--lts, lts/*, lts/argon) work with install, uninstall, use, exec, run, ls-remote and version-remote. The commands nvm install --lts and nvm use with lts/*, and a .nvmrc line of lts/*, all follow the latest LTS. Every command that selects versions takes --only= with the categories alpha, lts, non-lts and iojs, and NVM_ONLY sets the default. Adding --reinstall-packages-from=current to nvm install reinstalls your global packages on the new version.

NVM_NODEJS_ORG_MIRROR and NVM_IOJS_ORG_MIRROR point nvm at a mirror of the binaries. NVM_AUTH_HEADER sends an Authorization header to a mirror, never to any other host, except that BusyBox’s wget, the README says, sends it wherever the mirror redirects. The README recommends curl for a mirror that hands downloads to another host. A default-packages file in NVM_DIR lists the packages you want installed with every new version, one name per line. You can add anything npm would accept as a package argument on the command line. Adding -s to nvm install builds from source, and setting NVM_NO_SOURCE_FALLBACK to 1 makes a missing binary an error instead of a silent source build. A per-version lock stops two shells from installing the same version at once.

Good to know

nvm is installed per user and runs in your own shell, but its install steps write to your profile file and fetch files from the network.

  • Profile files: the install script appends source lines to the profile file it finds, and a bash_completion line to a bash or zsh profile. PROFILE=/dev/null keeps it from editing a profile
  • Downloads: nvm fetches Node.js from nodejs.org, or from the mirror you set. The README’s sample install output shows a checksum step, Computing checksum with sha256sum and then Checksums matched
  • Credentials: NVM_AUTH_HEADER goes only to mirror URLs with curl, which nvm prefers, and with GNU Wget. The README says BusyBox’s wget sends it wherever the mirror redirects. nvm prints mirror URLs that carry credentials with them masked as ***@
  • Building from source: when no binary exists nvm compiles Node.js, which is slow and needs a C++ toolchain
  • One user: nvm is available only to the account that installed it, so other users on the machine do not see it
  • Not supported: the README says Homebrew installs and the fish shell are not supported, and it calls the Windows tools it lists instead unsupported by the nvm team. Only the latest nvm release is supported
  • Settings that clash: a prefix in ~/.npmrc, the NPM_CONFIG_PREFIX and PREFIX variables, and set -e cause issues
  • Removal: the README gives manual steps. Run nvm unload, delete the install directory, then remove the nvm lines from your profile
  • License: MIT. The LICENSE.md file names Tim Caswell (2010) and Jordan Harband (2014), and the README’s copyright notice names the OpenJS Foundation and nvm contributors

README and files

README

nvm: setup notes

This kit holds setup notes only. Mindket wrote them. nvm itself, its install script and its shell files come from its maker's repository: https://github.com/nvm-sh/nvm

These notes are not made or endorsed by the nvm project. The GitHub description reads "Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions." The README says "nvm allows you to quickly install and use different versions of node via the command line."

License: MIT. The LICENSE.md file (https://github.com/nvm-sh/nvm/blob/master/LICENSE.md) reads "The MIT License (MIT)", "Copyright (c) 2010 Tim Caswell" and "Copyright (c) 2014 Jordan Harband". The README's copyright notice reads "Copyright OpenJS Foundation and nvm contributors. All rights reserved." and says the OpenJS Foundation has registered trademarks.

The README says only the latest version of nvm is supported. Its commands name a release tag (v0.40.8 when these notes were written). Use the tag the README names when you read it.

What installs

  • The install script puts nvm in ~/.nvm, or in $XDG_CONFIG_HOME/nvm when $XDG_CONFIG_HOME is set. With git it clones the repository there. Without git, install.sh downloads nvm.sh, nvm-exec and bash_completion with curl or wget. Source: https://github.com/nvm-sh/nvm/blob/master/README.md (Install & Update Script, Additional Notes)
  • Source lines in your shell profile (~/.bashrc, ~/.bash_profile, ~/.zshrc, ~/.zprofile or ~/.profile; install.sh checks ~/.zprofile too). The install script (https://github.com/nvm-sh/nvm/blob/v0.40.8/install.sh) also appends a line that loads bash_completion to a bash or zsh profile.
  • Each Node.js version you install later, under ~/.nvm/versions/node/. Source: README.md (Important Notes)
  • nvm is a sourced shell function, not an executable. The README says which nvm does not work, so check it with command -v nvm.

What you need first

  • bash to run the install script: install.sh exits with "the install instructions explicitly say to pipe the install script to bash" under any other shell. Once installed, nvm runs in any POSIX-compliant shell. The README lists sh, dash, ksh, zsh and bash.
  • On macOS, the Xcode command line tools, installed before you run the install script. The README says the script fails without them, and install.sh tells you to run xcode-select --install.
  • git, curl or wget. The README says the installer uses whichever is available. Its Git install route needs git v1.7.10 or newer.
  • A C++ compiler, only when a Node.js version has no prebuilt binary for your platform and nvm builds it from source. The README names Xcode on macOS and the build-essential and libssl-dev packages on Debian and Ubuntu.
  • Not supported, per the README: the fish shell and a Homebrew install. On Windows, the README says nvm should work through WSL, Git Bash (MSYS) or Cygwin. For anything else it lists nvm-windows, nodist and nvs, which it says the nvm team neither supports nor develops. See setup/windows.md, setup/nvmrc-and-shells.md and setup/macos.md.

The README's install steps ask for no account or key.

Main install command

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash

Source: https://github.com/nvm-sh/nvm/blob/master/README.md (Install & Update Script)

Setup notes for each platform

  • setup/linux.md
  • setup/macos.md
  • setup/windows.md: WSL, Git Bash and Cygwin, and the README's list of alternatives
  • setup/docker-and-ci.md
  • setup/alpine-linux.md
  • setup/commands.md: the commands and environment variables the README documents
  • setup/nvmrc-and-shells.md: .nvmrc and automatic switching in bash, zsh and fish (bash completion is in setup/commands.md)
  • setup/mirrors-and-other-platforms.md: mirrors, the authorization header and platforms without official binaries

Update or remove

To update, the README says to run the install script again, the same command as the install. For a manual upgrade with git (git v1.7.10 or newer), it gives these lines, which change to $NVM_DIR themselves:

(
  cd "$NVM_DIR"
  git fetch --tags origin
  git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$NVM_DIR/nvm.sh"

To remove nvm, the README gives these lines. First unload nvm and delete the installation directory:

nvm_dir="${NVM_DIR:-~/.nvm}"
nvm unload
rm -rf "$nvm_dir"

Then edit ~/.bashrc (or your other shell resource file) and remove the lines below:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[[ -r $NVM_DIR/bash_completion ]] && \. $NVM_DIR/bash_completion

The install script itself writes the completion line in this form (install.sh), so remove whichever form your profile holds:

[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Source: https://github.com/nvm-sh/nvm/blob/master/README.md (Install & Update Script, Manual Upgrade, Uninstalling / Removal)

Sources

Files
README.md  5 KB
setup/alpine-linux.md  3 KB
setup/commands.md  11 KB
setup/docker-and-ci.md  3 KB
setup/linux.md  5 KB
setup/macos.md  6 KB
setup/mirrors-and-other-platforms.md  4 KB
setup/nvmrc-and-shells.md  8 KB
setup/windows.md  3 KB

9 files, 49 KB, downloaded as a zip.

What’s new

  • Version 2 · 2026-11-09

    Updated by Mindket to the current version of this kit.

  • Version 1 · 2026-11-03

Reviews

No ratings yet

Write a review

No reviews yet.

What people say

Posts and comments that name this project on Hacker News, Bluesky, X, Reddit, Facebook and YouTube, found by a weekly search and on Trendshift. Mindket doesn’t write or check them. Open one to read it where it was posted.

abejfehrLife is too short for a slow terminalThis wasn't an option for us because as an org we used their recommended hook (1) to automatically change node versions when switching directories, but it effectively undoes the lazy loading. With mise you get the behaviour of automatically switching when you change directories effectively for…Jordan Harbandnvm v0.41.0 is out! New: --only=alpha,lts,non-lts,iojs to pick versions by category (alphas hidden by default), --lts aliases, annotated ls-remote. Plus 59 bug fixes and 7 security fixes, 25 of which were found and fixed with help from @anthropic.com's OSS Scanner. github.com/nvm-sh/nvm/r...22 likes@devmoonpynvm's Oct 29 advisory: untrusted version strings can inject sed commands (shell execution with GNU sed). Certain .nvmrc auto-switch hooks expose this on directory entry; plain `nvm use` is unaffected. Upgrade to 0.40.6+. https://t.co/GznK44KANa__MatrixMan__Show HN: Vet – A tool for safely running remote shell scriptsI'm glad to see that I'm not the only person worried about this. It's a pretty glaring bit of attack surface if you ask me. I chuckled when I saw you used nvm as an example in your readme. I've pestered nvm about this sort of thing in the past (https://github.com/nvm-sh/nvm/issues/3349). I'm a…Jordan Harbandnvm.sh v0.40.8 is out, fixing a path traversal vuln and a number of bugs - cve.org/CVERecord?id... - github.com/nvm-sh/nvm/r...4 likes@reed_florenNVM — swaps between Node versions in a single terminal with one POSIX-compliant script so your team never breaks a build because someone forgot to upgrade 🚀 https://t.co/x07CBqoYehivewonyoungAnyone can push updates to the doge.gov websiteAre they just running shell scripts off the public web for deploying federal gov sites that are targeted by nation states? From the docker file: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.shEvangeline Rome 🌵🦎🌱🐢🐍🐸 🥦I had a big delay spawning Bash every time because of github.com/nvm-sh/nvm A giant, ugly pile of bash1 like · 1 reply@vintcessunNode 项目一多,版本冲突到底该谁管?nvm 把这摊麻烦收拾得很干净。 https://t.co/b6UrHjmLRm 它按用户、按 Shell 隔离 Node 版本,用 .nvmrc 固化项目要求,切换时直接调整环境路径;并发安装还有锁和原子替换,避免版本目录被写坏。难得的是把开发机上的脏活做稳了。Fish 不原生支持,CI 的非交互 Shell 也要额外加载配置。timrichardMako – fast, production-grade web bundler based on RustI followed the standard nvm install process, to get it loaded from my .zshrc I noticed a second or two in lag between launching the terminal and getting a shell prompt. Commenting out the nvm load as a test removed the delay. I installed fnm, aliased it to be nvm, and everything is snappy. Also…Jeroenneman 👨🏻💻 🇪🇺For those with nodejs #Node2Shell - if nvm not installed: curl -o- raw.githubusercontent.com/nvm-sh/nvm/v... | bash exit -> back in - nvm -v - nvm install 22.23.4 (or any patched version) --reinstall-packages-from=current - validate node version: node -v1 reply@ljharbhttps://t.co/apjiDcq0Vs v0.40.5 is out, with some CVE fixes: https://t.co/h0bHtPciCP Be sure to update!

Searched

More from Mindket

See all from Mindket

Huashu Design

alchaincyf · Skill

Turns a one-line request in your AI agent into a finished design: a launch animation, a clickable app prototype, an editable slide deck, an infographic or a se…

New29.4k

Guizang PPT Skill

op7418 · Skill

Skill that makes single-file HTML slide decks, slide illustrations and platform covers in two visual styles, with a presenter mode for rehearsal. For speakers…

New29.8k

Claude Code Skills & Plugins

alirezarezvani · Skill

Adds 411 ready-made skills for Claude Code and other coding agents, grouped by role from engineering and product to marketing, finance and compliance. Installs…

New29.8k

Similar in Developer

See all in Developer

buzz

block · Kit

Self-hostable workspace where people and AI agents share the same rooms, built on a Nostr relay that logs every action as a signed event. For teams that want t…

New37.3k

plannotator

backnotprop · Kit

Opens your AI coding agent's plans, specs and code changes in a browser so you can annotate or comment on them and send the feedback straight back to the agent.

New10.5k

open-code-review

alibaba · Kit

Reviews Git changes with an AI agent that reads files and searches the codebase, then writes comments tied to exact lines. It suits developers who want automat…

New50.7k