Pure-fish, Node.js version manager.
.nvmrcsupport.- Seamless shell integration.
- Tab-completions? You got it.
- No dependencies, no subshells, and no configuration setup—it just works.
- Basically pretty easy to use, minimal & awesome (see this comparison).
Install with Fisher (recommended):
fisher add jorgebucaran/fish-nvm
Not using a package manager?
Copy conf.d/nvm.fish, functions/nvm.fish, and completions/nvm.fish to your fish configuration directory preserving the directory structure.
set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
for i in conf.d functions completions
curl https://git.io/$i.nvm.fish --create-dirs -sLo $XDG_CONFIG_HOME/fish/$i/nvm.fish
endTo uninstall, run the following code:
rm -f $XDG_CONFIG_HOME/fish/{conf.d,functions,completions}/nvm.fish && emit nvm_uninstall
Download and switch to the latest Node.js release.
nvm use latestNote: This downloads the latest Node.js release tarball from the official mirror, extracts it to
$XDG_CONFIG_HOME/nvmand modifies your$PATHso it can be used immediately. Learn more about the Node.js release schedule here.
Download and switch to the latest LTS (long-term support) Node.js release.
nvm use lts
You can create a .nvmrc file in the root of your project (or any parent directory) and run nvm to use the version in it. nvm will try to find the nearest .nvmrc file, traversing the directory tree from the current working directory upwards.
node -v > .nvmrc
nvmRun nvm in any subdirectory of a directory with an .nvmrc file to switch to the version from that file. Similarly, running nvm use <version> updates that .nvmrc file with the specified version.
├── README.md
├── dist
├── node_modules
├── package.json
└── src
└── index.js
echo lts >.nvmrc
cd src
nvm
node -v
v10.15.1List all the supported Node.js versions you can download and switch to.
nvm ls
...
10.14.2 (lts/dubnium)
10.15.0 (lts/dubnium)
11.0.0
11.1.0
11.2.0
11.3.0
11.4.0
11.5.0
11.6.0
11.7.0 (latest/current)You can use a regular expression to narrow down the output.
nvm ls '^8.[4-6]'
8.4.0 (lts/carbon)
8.5.0 (lts/carbon)
8.6.0 (lts/carbon)To customize the download mirror, e.g., if you are behind a firewall, you can set $nvm_mirror:
set -g nvm_mirror http://npm.taobao.org/mirrors/node