Contribute to help us improve!
Are there edge cases or problems that we didn't consider? Is there a technical pitfall that we should add? Did we miss a comma in a sentence?
If you have any input for us, we would love to hear from you and appreciate every contribution. Our goal is to learn from projects for projects such that nobody has to reinvent the wheel.
Let's collect our experiences together to make room to explore the novel!
To contribute click on Contribute to this page on the toolbar.
nvm: the node version manager
nvm is a version manager for node.js, designed to be installed per-user, and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL.
Installing and Updating
To install or update nvm, you should run the install script. To do that, you may either download and run the script manually, or use the following cURL or Wget command:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Running 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 (
More info at https://github.com/nvm-sh/nvm#install—update-script.
|Uninstall any pre-existing node.js installation. Windows users should use the Windows installer.|
nvm-windows is similar to nvm but not identical. The installer can be downloaded from here.
More info at https://github.com/coreybutler/nvm-windows.
To download, compile, and install the latest release of node, do this:
nvm install node # "node" is an alias for the latest version
To install a specific version of node:
nvm install 14.7.0 # or 16.3.0, 12.22.1, etc
The first version installed becomes the default. New shells will start with the default version of node (e.g.,
nvm alias default).
We recommend to install and make it default the latest node.js LTS version.
nvm install --lts nvm alias default lts/* # "lts/*" is an alias for the latest LTS version
More info at https://github.com/nvm-sh/nvm#usage.
You 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). Afterwards,
nvm run, and
nvm which will use the version specified in the
.nvmrc file if no version is supplied on the command line.
For example, to make nvm default to the latest 5.9 release, the latest LTS version, or the latest node version for the current directory:
$ echo "5.9" > .nvmrc $ echo "lts/*" > .nvmrc # to default to the latest LTS version $ echo "node" > .nvmrc # to default to the latest version
NB these examples assume a POSIX-compliant shell version of
Then when you run nvm:
$ nvm use Found '/path/to/project/.nvmrc' with version <5.9> Now using node v5.9.1 (npm v3.7.3)
nvm use et. al. will traverse directory structure upwards from the current directory looking for the
.nvmrc file. In other words, running
nvm use et. al. in any subdirectory of a directory with an
.nvmrc will result in that
.nvmrc being utilized.
The contents of a
.nvmrc file must be the
<version> (as described by
nvm --help) followed by a newline. No trailing spaces are allowed, and the trailing newline is required.