Pure-fish, Node.js version manager
Branch: master
Clone or download
Latest commit 19467ff Jan 30, 2019

README.md

fish-nvm (Node.js Version Manager)

Build Status Releases

Node.js version manager for the fish shell.

Features

  • .nvmrc support
  • Seamless shell integration
    • Tab-completions? You got it
  • No dependencies, no subshells, no configuration setup—it just works

Installation

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
end

To uninstall, run the following code:

rm -f $XDG_CONFIG_HOME/fish/{conf.d,functions,completions}/nvm.fish && emit nvm_uninstall

System Requirements

Usage

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 immediately. 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 an .nvmrc file in the root of your project (or any parent directory) and run nvm to use the version 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 use the version from that file. Likewise, running nvm use <version> will update that .nvmrc file with the indicated version.

├── README.md
├── dist
├── node_modules
├── package.json
└── src
    └── index.js
echo lts >.nvmrc
cd src
nvm
node -v
v10.15.1

Listing versions

This will list all the supported Node.js versions you can use.

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

License

MIT