Skip to content

thetinygoat/nvm.fish

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nvm.fish

100% pure-fish Node.js version manager.

  • .nvmrc support.
  • Seamless shell integration. Tab-completions? You got them.
  • No dependencies, no subshells, no configuration setup, no fluff—it's so easy it hurts.
  • Because nvm.fish runs natively by fish, it's insanely fast (see this discussion).

Installation

Install with Fisher (recommended):

fisher add jorgebucaran/nvm.fish
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 nvm, just run:

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

Quickstart

Download and switch to the latest Node.js release.

nvm use latest

Note: This downloads the latest Node.js release tarball from the official mirror, extracts it to $XDG_CONFIG_HOME/nvm and modifies your $PATH so 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
nvm

Run 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.1

Listing versions

List 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 https://npm.taobao.org/mirrors/node

License

MIT

About

100% pure-fish Node.js version manager.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%