Wednesday, 30 August 2017

Setup MEAN Stack with Angular 2 in Ubuntu 16.04

Steps to install and configure MEAN stack necessary application in Ubuntu 16.04

Install the following
1) MongoDB/NoSQL:              sudo apt-get install mongod

2) Express JS globally:            sudo npm install -g express

3) Angular CLI:                        sudo npm install -g angular/cli

4)Node JS and npm:               sudo apt-get install nodejs npm

To upgrade to latest NodeJS

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node   /usr/bin/nodejs

(NOTICE that the default installation for nodejs is in the /usr/bin/nodejs and not /usr/bin/node)

To upgrade to latest version (and not current stable) version, you can use

sudo n latest

Other useful nifty commands:

npm init
creates a package.json in root for you

npm list
lists all installed packages

npm prune
removes packages not depended on by your project according to your package.json

npm outdated
tells you which installed packages are outdated with respect to what is current in the npm registry but allowable by the version definition in your package.json