Getting Started with v2 started out as a combination of MongoDB, ExpressJS, AngularJS, and Node.js. With the release of v2 we provide you with the ability to mix and match additional front-end frameworks, databases and technologies. In our development of version 2, we aimed to create a robust, flexible and scalable full-stack Javascript solution.

We created this tutorial to guide you through the process of installing of the v2 framework and it’s prerequisites on various different platforms.

What You will Need to Install v2

In order to explore the new features of v2 you will need to install the framework in your local environment. Before you install you will need to install the following software.

  1. Node.js
  2. MongoDB
  3. Git
  4. npm

Install Node.js in Your Local Environment v2 requires a version of Node.js higher than 6.x as well as a version of npm higher than 3.x.

Installing Node.js on Linux and OSX

You can download Node.js from the official web site. But in order to manage multiple versions of Node, it’s better to install Node.js via the Node Version Manager (NVM) which you can find in nvm’s github repo. Follow the steps in the nvm repo README to install Node.js on your local system. Make your you install a version of Node.js which is greater than 6.x. Installing this Node.js in this way will automatically install npm version 3.x as well.

Installing Node.js on Windows

Windows users may also install Node.js via a version of NVM. Although it is not exactly the same tool as used in Linux, it fulfills the same task.

To download the version of NVM for windows, visit the nvm-windows github repo and follow the steps in the README.

Emulated Linux Terminal on Windows

To gain access to a emulated Linux terminal on Windows, Windows users can use the cmder terminal emulator for a better experience with Node.js.

How to use NVM to install Node.js

No matter which platform you are using, you can always use NVM in the same way. In this section we will show you how to install Node.js using NVM.

After installing NVM, enter the command ‘nvm’ into your terminal. If NVM is not installed, you will receive the ‘command not found’ error message. Otherwise, you will see some instructions and commands that you can use with NVM.

After you have confirmed that NVM is installed in your system, you can use the following command to check the versions of Node.js which are currently installed in your system.

nvm list

In order to use version 2 of, we recommend that you install a 6.x version of Node.js. So, for example if the most recent version of Node.js available was 6.11.4, you would use this command to install Node.js 6.11.4.

nvm install 6.11.4

If you use ‘nvm install node’ it will install the latest stable version of Node.js. But for the MEAN2 , we reccomond Node 6.x version.

After the installation of Node, you have to use following code to use installed version of Node 6.11.4

nvm use 6.11.4

Installing MongoDB in Linux (Ubuntu 16)

There are a few ways to install MongoDB on Linux (Ubuntu). In this tutorial i’m going to use the most official and easiest way to do it.First we need to import GPG keys for the official MongoDB repository. Use following command to do it. You need to use ‘sudo’. It’s mandetory.

sudo apt-key adv –keyserver hkp:// –recv EA312927

Then we have to add MongoDB repository details to our system. Then the system know exactly where to download them.

echo “deb xenial/mongodb-org/3.2 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list

After adding these details, you need to update the package list in order to update system with new repositories.

sudo apt-get update

Now we can install the MongoDB package itself.

sudo apt-get install -y mongodb-org

We need to add MongoDB as a service in Ubuntu. So you have to use following instructions properly.

sudo nano /etc/systemd/system/mongodb.service

Now you need to paste following instructions to this file, save it and close it.

Description=High-performance, schema-free document-oriented database

ExecStart=/usr/bin/mongod –quiet –config /etc/mongod.conf


Now you have to start the MongoDB instance

sudo systemctl start mongodb

This command doesn’t give you any output. So you can check the status using following command.

sudo systemctl status mongodb

To start MongoDB on system boot, you have to use following command.

sudo systemctl enable mongodb

Installing MEAN on Linux/Mac OS

After installing Node in your local system, you need to install MEAN from github. In order to clone official git repository, you need to have Git installed too. ( For the database configuration, you need to have MongoDB installed in your local system. ( After your development environment is fixed , you are ready to install MEAN.

First clone the repository from github.When you are clonning the repo, you have to take master branch. That is the branch which is clonning automatically when you are running following code.

git clone –depth 1

Then you need to go to clonned repository using

cd mean

Now you have latest version of MEAN. Now it’s time to install all the dependencies.

npm install

After the installation done, you can see your node_modules folder and complete message at the end of the terminal. If you have any errors, you can refer following links to get an idea about basic Node and NPM issues.

Now all you need to do is run the project using

npm start

If all your system configuration and other tools (including MongoDB and other global npm packages) are in order, the application will open using :


Possible issues when trying to run the application

1. MongoDB issues

MEAN stack is well tested and developed by the team. But it’s also depend by many other third part tools. So there can be some issues according to which version of tools you have in your local system.

As an example, many users faced some issues when application is trying to make connection with MongoDB. It can be a issue with local mongoDB system. Or other GraphQL version or any other tool which required to access database.

If you are having any issues with MongoDB , you need to check weather it’s happening because of Database or MEAN dependency issue. Best way to check that issue is using a hosted MogoDB instance.

You can create a free MongoDB instace using this site. Then all you have to do is give the lates MongoDB credentials to your application. In the project root folder structure, you can find “server-start.js” file. All you have to do is change a one line like this.


All you need to do is, create a database instance named “new-mean” in your free mLab account and then you can see connection link when you enter the instance in mLab account. Replace and with your details.

When you are running the application with mLab dabatase credentials and if it’s running without errors, you can debug your local MongoDB instance. There is an issue with it. If you are getting same error again, then issue is with MEAN dependencies. So you better open a new issue in MEAN repository.

If you can run the application without any issues, you can get the following output. MEAN will open your default web browser and you can see this :

mean home page

After installation, you can get MongoDB error if versions and dependencies are not compatible, so if there are any, the best way is try to debug MongoDB and MEAN by seperating them as I have shown above.

Installing MEAN on Windows

Installing MEAN on Windows is moslty same as installing on Linux. But need to have some extra configuration first. You need to make sure following tools intalled properly.

  1. Git
  2. MongoDB
  3. Python (Make sure you have Python 2.x , NOT 3.x versions)

When using MEAN on Windows, you need Python to build the application. Otherwise you will get errors. After installing all above, you need to run these commands. When you are clonning the repo, you have to take master branch. That is the branch which is clonning automatically when you are running following code.

git clone –depth 1
cd mean
npm install

Possible issues when trying to run the application

1. Shasum Check Failed issue

This is a common issue when we are installing npm packages. This happenes when some package versions mis match or some dependency issues.

There is a quick fix for this issue. You can see it tried to install one dependency file and it’s not installing automatically. All you have to do is take that link and manually install. In this case, it’s like this.

npm install

Then you have to run

npm clean cache

And then you can continue

npm install

Now npm install process will continue without any issues regarding to this file.

2. Can’t find Python issue

When installing MEAN on Windows , you need to have python installed in your local system. Python is required to the build process of MEAN. And also make sure you have Python 1.x or Python 2.x versions installed in your system. Most of the times, Python 3.x version gives an error because MEAN is looking for Python or Python2.