fish-nvm is a Node.js version manager for the fish shell.
- Zero configuration, pure-fish, binary management
- No subshells, no dependencies, no nonsense
- Tab completions included out of the box
fisher add jorgebucaran/fish-nvm
Download nvm.fish
to your fish configuration directory to install (or upgrade) nvm manually. If nvm
is not immediately available after the download, you can launch a new session, or replace the current session with a new one.
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
end
To uninstall nvm from your system run this code.
rm -f $XDG_CONFIG_HOME/fish/{conf.d,functions,completions}/nvm.fish && emit nvm_uninstall
This will download the latest Node.js release tarball from the official mirror, extract it to $XDG_CONFIG_HOME/nvm
and modify your $PATH
so it can be used right away. Learn more about the Node.js release schedule here.
nvm use latest
This will download and use 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 contained in it. We'll attempt to find the nearest .nvmrc
file, traversing the directory tree from the current working directory upwards.
echo 10 >.nvmrc
nvm
Running nvm
in any subdirectory of a directory with an .nvmrc
file will read the Node.js version from that file. Similarly, running nvm use <version>
will update that .nvmrc
file with the specified version.
├── README.md
├── dist
└── foo.min.js
├── node_modules
├── package.json
└── src
└── index.js
echo 10 >.nvmrc
cd src
nvm
node -v
10.15.0
List all supported Node.js versions.
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)
Want to narrow that down a bit? You can use a regular expression to refine the output.
nvm ls '^8.[4-6]'
8.4.0 (lts/carbon)
8.5.0 (lts/carbon)
8.6.0 (lts/carbon)
Are you behind a firewall? Use the $nvm_mirror
variable to customize the download mirror.
set -g nvm_mirror http://npm.taobao.org/mirrors/node