2 min read

How to install node and npm on a Mac (mojave)

Non official guide to install node.js and npm on a mac (tested with osx mojave version)

There are several ways to install node on any mac, but my recomendation will be to unstal it using brew and nvm.
I think that is the best approach for several reasons:

  1. You will find that some times you want to switch between several versions of node depending on the libraries that you use, you dont want to be stuck in just one version.
  2. Brew is an amazing package manager for mac that contains very mature packages already bullet prove on any possible bugs.

Steps to install:

  1. Install brew (if you don't have it already)
    According to the brew official website you only to paste need one command on the console:
  $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. Install NVM using brew
 $ brew install nvm
  1. Load it in the terminal
$ mkdir -p ~/.nvm
$ echo $'export NVM_DIR="$HOME/.nvm"\n. "/usr/local/opt/nvm/nvm.sh"' >> ~/.bash_profile
  1. Restart your current terminal

    $ source ~/.bash_profile
  2. Install node version 8 or whatever version you want

    $ nvm i 8

If you had any errors

Please file an issue here and we will do our best to help you. You can also contribute and PR any updates you think should be made to this guide..