How to install Node.js using Node Version Manager

Node Version Manager (NVM) lets you install multiple versions of Node.js to your local user directory, enabling easy upgrades and version switching, without the permission troubles that are common with non-NVM setups.

  • Uninstall any previous Node.js versions you may already have
  • Install NVM by running the following in Terminal:
    git clone git:// ~/.nvm
    printf "\n\n# NVM\nif [ -s ~/.nvm/ ]; then\n\tNVM_DIR=~/.nvm\n\tsource ~/.nvm/\nfi" >> ~/.bashrc
    source ~/.nvm/
  • Install Node.js by running the following in Terminal:
    nvm install node
    nvm alias default node
    nvm use node