Zsh Nvm

Zsh plugin for installing, updating and loading nvm
Alternatives To Zsh Nvm
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Webpack62,793643,832190,233a day ago806July 25, 2022355mitJavaScript
A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.
Webpack Demos9,174
2 years ago1JavaScript
a collection of simple demos of Webpack
Happypack4,1102,1641,2463 years ago38January 04, 201948mitJavaScript
Happiness in the form of faster webpack build times.
Vue Infinite Loading2,46436154a year ago49June 30, 202167mitJavaScript
An infinite scroll plugin for Vue.js.
Hard Source Webpack Plugin2,2412,8827623 years ago164December 10, 201883iscJavaScript
Zsh Nvm1,952
22 days ago32mitShell
Zsh plugin for installing, updating and loading nvm
Speed Measure Webpack Plugin1,94628,592311a year ago34March 28, 202158mitJavaScript
⏱ See how fast (or not) your plugins and loaders are, so you can optimise your builds
Workflow1,8829a year ago15April 26, 202122JavaScript
Embulk1,683119872 days ago123June 30, 2022202apache-2.0Java
Embulk: Pluggable Bulk Data Loader.
Webpack Bundle Size Analyzer1,4001,88026121 days ago20September 24, 201923iscTypeScript
A tool for finding out what contributes to the size of Webpack bundles
Alternatives To Zsh Nvm
Select To Compare

Alternative Project Comparisons

zsh-nvm Build Status

Zsh plugin for installing, updating and loading nvm

GitHub Donate Bitcoin Donate Lightning Donate

nvm is an awesome tool but it can be kind of a pain to install and keep up to date. This zsh plugin allows you to quickly setup nvm once, save it in your dotfiles, then never worry about it again.

The plugin will install the latest stable release of nvm if you don't already have it, and then automatically source it for you. You can upgrade nvm to the latest version whenever you want without losing your installed node versions by running nvm upgrade.

Although this is written as a zsh plugin, it also works with bash if you follow the manual installation instructions.


Once the plugin's installed nvm will be available. You'll probably want to load this as one of your first plugins so node/npm is available for any other plugins that may require them.

zsh-nvm also wraps nvm in some additional functionality.


If you want to upgrade to the latest release of nvm:

% nvm upgrade
Installed version is v0.31.0
Checking latest version of nvm...
Updating to v0.31.3...
Previous HEAD position was 2176894... v0.31.0
HEAD is now at 56417f8... v0.31.3


If an upgrade breaks something don't worry, reverting back to the previously installed version is simple:

% nvm revert
Installed version is v0.31.3
Reverting to v0.31.0...
Previous HEAD position was 56417f8... v0.31.3
HEAD is now at 2176894... v0.31.0


You can install the latest Node.js nightlies or release candidates with nvm install nightly|rc. Aliases will automatically be created so you can easily nvm use nightly|rc in the future:

% nvm install rc
Downloading and installing node v8.0.0-rc.1...
Downloading https://nodejs.org/download/rc//v8.0.0-rc.1/node-v8.0.0-rc.1-darwin-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v8.0.0-rc.1 (npm v5.0.0-beta.56)
rc -> v8.0.0-rc.1
Clearing mirror cache...

Note: This is a bit of a hack and leaving rc|nightly versions installed may break nvm when it eventually supports them itself. It's recommended that you don't leave the these versions of Node.js installed. Install them, test/play with them and then uninstall them when you're done.


Custom Directory

You can specify a custom directory to use with nvm by exporting the NVM_DIR environment variable. It must be set before zsh-nvm is loaded.

For example, if you are using antigen, you would put the following in your .zshrc:

export NVM_DIR="$HOME/.custom-nvm-dir"
antigen bundle lukechilds/zsh-nvm

Note: If nvm doesn't exist in this directory it'll be automatically installed when you start a session.

Nvm Completion

nvm comes with a default bash_completion profile. If you want to enable it, you can do it by exporting the NVM_COMPLETION environment variable and setting it to true. It must be set before zsh-nvm is loaded.

For example, if you are using antigen, you would put the following in your .zshrc:

# Export nvm completion settings for zsh-nvm plugin
export NVM_COMPLETION=true
antigen bundle lukechilds/zsh-nvm

Lazy Loading

If you find nvm adds too much lag to your shell startup you can enable lazy loading by exporting the NVM_LAZY_LOAD environment variable and setting it to true. It must be set before zsh-nvm is loaded.

Lazy loading is around 70x faster (874ms down to 12ms for me), however the first time you run nvm, npm, node or a global module you'll get a slight delay while nvm loads first. You'll only get this delay once per session.

For example, if you are using antigen, you would put the following in your .zshrc:

export NVM_LAZY_LOAD=true
antigen bundle lukechilds/zsh-nvm

Performance comparison:

% time (source "$NVM_DIR/nvm.sh")
( source "$NVM_DIR/nvm.sh"; )  0.58s user 0.37s system 109% cpu 0.874 total

% time (_zsh_nvm_lazy_load)
( _zsh_nvm_lazy_load; )  0.01s user 0.01s system 168% cpu 0.012 total

Extra commands to trigger lazy loading

By default lazy loading nvm is triggered by running the nvm, node, npm commands or any installed npm global binaries. If you want to trigger the lazy loading via extra arbitrary commands you can define NVM_LAZY_LOAD_EXTRA_COMMANDS and set it to an array of commands as strings. This can be usefull if programs are not in the above list of binaries but do depend on the availability of node, e.g. a vim plugin.

vim --version
#node is now loaded

Don't autoload node

By default when nvm is loaded it'll automatically run nvm use default and load your default node version along with npm and any global modules. You can disable this behaviour by exporting the NVM_NO_USE environment variable and setting it to true. It must be set before zsh-nvm is loaded.

If you enable this option you will then need to manually run nvm use <version> before you can use node.

For example, if you are using antigen, you would put the following in your .zshrc:

export NVM_NO_USE=true
antigen bundle lukechilds/zsh-nvm

Auto use

If you have lots of projects with an .nvmrc file you may find the auto use option helpful. If it's enabled, when you cd into a directory with an .nvmrc file, zsh-nvm will automatically load or install the required node version in .nvmrc. You can enable it by exporting the NVM_AUTO_USE environment variable and setting it to true. It must be set before zsh-nvm is loaded.

If you enable this option and don't have nvm loaded in the current session (NVM_LAZY_LOAD or NVM_NO_USE) it won't work until you've loaded nvm.

For example, if you are using antigen, you would put the following in your .zshrc:

export NVM_AUTO_USE=true
antigen bundle lukechilds/zsh-nvm


Using Antigen

Bundle zsh-nvm in your .zshrc

antigen bundle lukechilds/zsh-nvm

Using zplug

Load zsh-nvm as a plugin in your .zshrc

zplug "lukechilds/zsh-nvm"

Using zgen

Include the load command in your .zshrc

zgen load lukechilds/zsh-nvm

As an Oh My ZSH! custom plugin

Clone zsh-nvm into your custom plugins repo

git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm

Then load as a plugin in your .zshrc


Keep in mind that plugins need to be added before oh-my-zsh.sh is sourced.


Clone this repository somewhere (~/.zsh-nvm for example)

git clone https://github.com/lukechilds/zsh-nvm.git ~/.zsh-nvm

Then source it in your .zshrc (or .bashrc)

source ~/.zsh-nvm/zsh-nvm.plugin.zsh


To run the tests you'll need to install Urchin. You'll also need to run the tests in an environment that doesn't already have node or nvm loaded.

You can remove nvm from the existing session with:

nvm deactivate && nvm unload

Run the tests with:

urchin -s zsh tests



MIT © Luke Childs

Popular Loader Projects
Popular Plugin Projects
Popular User Interface Components Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Zsh Plugin
Lazy Loading
Version Manager
Oh My Zsh