Install nvm – Node Version Manager & node on Mac

Quick tip of the day. How to install nvm (Node Version Manager) & Node?

osMac:
I am going to use Homebrew to install NVM on Mac, follow the steps given below.

  1. brew update
  2. brew install nvm
  3. mkdir ~/.nvm
  4. nano ~/.bash_profile

Once you have run above commands successfully, next you need to modify your .bash_profile or .zshrc (robbyrussell/oh-my-zsh) depends what you are using. Add following two lines at the end the .bash_profile file.

  1. export NVM_DIR=~/.nvm
  2. source $(brew --prefix nvm)/nvm.sh

Save and exit the file to check if nvm is installed and configured correctly.

  1. source .bash_profile
  2. echo $NVM_DIR , if you see the correct nvm path, then all set.

Let’s install node, but before you install node take a look at available node versions in order to get idea how they are named.

  1. nvm ls-remote, go for your desire version or you can alway look for “(Latest LTS: Dubnium)”
  2. nvm install v10.13.0

After this you have successfully install nvm, node & npm, run following commands to verify installed versions.

  1. node -v
  2. npm -v

That’s it, see you in next quick tip.

 

Author: Danyal
I'm a skilled programmer specializing in Vue.js/Nuxt.js for front-end development and PHP Laravel for back-end solutions. I have a strong focus on API design and development, complemented by experience in web server setup and maintenance. My versatile expertise ensures seamless creation and maintenance of web applications, covering everything from intuitive user interfaces to robust server-side functionality. Passionate about coding and driven by a lifelong learning mindset, I invite you to explore more at danyal.dk.