After trying multiple times to get the MEAN stack (MongoDB, Express, AngularJS, Node.js) up and running, I have finally hit upon the correct set of steps. For all the world's benefit, here is how to install MEAN.JS from scratch!
As a prerequisite to the following steps, I created an Ubuntu 14.04 droplet on Digital Ocean and went through their published steps to get everything set up.
curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash - sudo apt-get install --yes nodejs
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list sudo apt-get update sudo apt-get install -y mongodb-org
Make sure MongoDB is listening on the right port (should be 27017)
npm install -g bower
npm install -g grunt-cli
Download and install MEAN.JS
git clone https://github.com/meanjs/mean.git meanjs cd meanjs git checkout 0.4.0 npm install
At this point, you should be able to point your browser to <your_ip>:3000 to view the fruits of your labor. Unless, of course, you have a firewall problem. 🙂
One last note: don't use sudo to handle global npm installations. Use npm-g_nopsudo instead. After following those instructions, I had to do the following to make everything work right:
npm config set prefix ~/npm echo export PATH="$HOME/npm/bin:$PATH" >> ~/.bashrc echo "export NODE_PATH=$NODE_PATH:/home/$USER/npm/lib/node_modules" >> ~/.bashrc && source ~/.bashrc
I also had to do this for bower to work with git:
git config --global url."https://".insteadOf git://