How to do it...

  1. Open your command-line application.
  2. Clone the nvm project into a directory in your home folder:
git clone https://github.com/creationix/nvm.git ~/.nvm
  1. Add the following code to the bottom of your ~/.bashrc or ~/.zshrc file. If you don't know what shell you are running, it is probably bash and you should add the entry to ~/.bashrc:
# Configure NVM 
export NVM_DIR="$HOME/.nvm" 
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" 
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"   
  1. Save the file and return to your command line:
source ~/.bashrc # (or ~/.zshrc if you're running zshell)
  1. Confirm your installation by checking the version number of nvm:
> nvm --version0.33.5
  1. List all of the node versions available ...

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.