Prerequisites

  1. Install homebrew first

Installation

    brew install node

    # create a NODE_PATH variable in the env to provide an additional location to search for modules
    echo "export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules" >> ~/.bashrc && source ~/.bashrc

npm install will install the project dependencies specified in package.json. ie. if you clone a node project, the first thing to do is npm install

    npm install