MEAN installing prerequisites

Looking to learn something new I thought I would install the MEAN stack and try and write some code. I use both a Windows laptop and a Macbook so thought I would install on both and see how it goes.

What is MEAN?

MEAN stands for MongoDB, Express, Angular JS and Node.js. Using these four technologies you can write a web application using JavaScript for both client and server. Plus with Mongo you can store JSON straight in the database.

What are the prerequisites?

To get started with MEAN development you need to make sure the following are installed:

  • Git
  • Node.js
  • MongoDB

Everything else can be installed using the npm package manager that comes with Node.js.

Installing on a Mac

To help with installing I would recommend first installing a package manager called homebrew. It makes installing, updating and uninstalling packages a breeze. For up to date instructions I would visit the homebrew site, but to give you an idea how easy it is to install these are the current instructions.

Simply paste the following into a terminal prompt and press enter.

/usr/bin/ruby -e "$(curl -fsSL"

Next install Git

brew install git

And install mongo

brew install mongodb

Mongo will by default use a data library of /data/db so you either need to create this directory or override the default to a different one. Let’s just go ahead and create the default.

sudo mkdir -p /data/db

Next we need to change ownership of this directory so that mongo can use it.

sudo chown -R $USER /data/db

Details can be found on the mongo site.

Finally install node

This was the only step where I had some difficulty. It is recommended to use a version manager that allows multiple versions of node to be installed and you can switch between them in the terminal. The version manager I am using is NVM and the instructions I was using said to install NVM using ‘brew install nvm’. I found I couldn’t get this to work properly and when I checked the actual NVM github page it specifically says not to use homebrew. Fortunately it’s pretty easy to install anyway (for up to date instructions visit the NVM site).

Simply paste the following in a terminal and press enter:

curl -o- | bash

Restart the terminal to make sure NVM is started and install a version of node.

nvm install node

That’s all you need to begin with but you can see on the NVM site how to install additional versions, switch between them, set a default etc.

Installing on Windows

First up all three of these tools are designed to run on *nix. You can run these on Windows but it’s fair to say it’s not a natural home so you have to do a bit of extra work.

Install git

There are different ways to work with git on Windows but if you want to access the full range of commands then it pays to have a bash shell for Windows where you can run git on the command line. To do this I use git for Windows. Download from the following website and run the installer.

I’ve used this tool for a few years now and it is my go to shell for development if I want to run commands such as git or maven since I prefer the bash shell to Windows. However, recently with Windows 10 and the latest git bash shell I’ve had problems where it doesn’t pick up certain keystrokes. In particular the arrow keys don’t work so you can’t scroll through options. I managed to find a workaround on stackoverflow where you can launch git bash from within the Windows shell. E.g.

cmd.exe /C "C:\Program Files\Git\bin\bash.exe" --login -i

Install mongo

If you’re used to working with a database like MySQL then you have probably used the graphical installer which makes installing a breeze. Mongo lags behind a bit in this regard and getting setup is a much more manual process. However, there is a nice tutorial on the Mongo site which explains what to do.

The tutorial runs through how to install Mongo, set the directory where the data lives and create a Windows service to be able to Start/Stop MongoDB.

Install node

The Windows installer for node.js can be downloaded from the node site.

I have found that some node modules also need python to install properly. On a mac this isn’t a problem as python 2.7 comes pre-installed but on Windows you’ll need to install python separately.

The .msi installer for python can be downloaded from their website, I would install 2.7. If you’re not familiar with python there is a newer 3.5 version but it is not backwards compatible and most people still use 2.7!


I’m usually happy developing on either my Windows laptop or MacBook but I have to say that node development for me is much better suited to the mac. Everything installed easily and was a joy to use on the mac. Whereas on Windows I have wasted hours frustratingly having to search for workarounds to problems.

If you’re stuck on Windows then I’m not saying you have to buy a mac especially but if you have the choice then I would thoroughly recommend using a mac.