Getting started with the MEAN stack and Mean.io – Part 1

If you haven’t heard about it, the MEAN stack consists of:

  • mongoDB
  • ExpressJS
  • AngularJS, and
  • Node.js

The installation and set up process is described in a bunch of
places on the Web. I struggled through it, despite the supposedly
easy process.

I wish I had taken better notes on my initial set up troubles, but I’ll
have to begin by documenting my current state. I think I’ve finally
installed and set up my stack, and (based mostly on the guidance
provided in the mean.io tutoral) I’ve run grunt to start the server.

When I go to http://localhost:5858, however, I get this:

Type: connect
V8-Version: 3.14.5.9
Protocol-Version: 1
Embedding-Host: node v0.10.33
Content-Length: 0

What’s that? I thought it might be some debugging information
that would appear at the bottom of a page, but where’s the page?

In addition to installing the mean stack using the mean.io tools,
I am following the tutorial at thinkster.io, so I’ve created an index.html
and an app.js file. The server is definitely picking them up because it
was giving me some jshint error messages concerning the app.js file
(not using ‘use strict’). I am not, however, seeing anything from the
index.html file.

I have tried to search on the strings in the ostensible debugging info,
but I am coming up empty. Did I neglect to install something?

Maybe the grunt  command doesn’t start MongoDB and maybe
I have to have the DB running? I tried to start Mongo by running
“mongod” at the command line, but I got an error:

exception in initAndListen: 10310 Unable to lock file: /data/db/mongod.lock. Is a mongod instance already running?, terminating

A popular StackOverflow answer says the following command will solve this:

sudo chown -R `id -u` /data/db

That didn’t help though. I had already set the proper permissions on that directory.

Then I tried just checking to see if mongo was already running. I know I tried
this before but I must have just spaced out when I tried it. So I ran this:

ps ax | grep mongod

and killed the process called “mongodb”. Then I started it back up, and successfully viewed localhost:3000.

What I saw on my local server, however, was basically just a big advertisement
for the MEAN stack. Where was this page coming from? It certainly isn’t the
index.html file I had created in the tutorial.

Ok … I found it. The page, which looks like this:

mean.io default home page

This index.html file for this page is located here on my system:

[my mean project root path]/packages/system/public/views/index.html

I think I’m going to stop here for now. I feel like I’ve accomplished something
anyway. I have the server running, the db running, and I have at least a rough
idea of where the files are that I need to edit.