Troubleshooting

Create a new MEAN project

If you would like to create a new MEAN project, follow the steps below:

Log in to your server console.

Create a new folder for your project in the /home/bitnami directory.

$ cd /home/bitnami
$ mkdir projects

Create a new Express project:

$ cd /home/bitnami/projects
$ express sample

The MEAN stack already has the required components installed in Node.js, but if you prefer, you can install them in the new project folder:

$ cd /home/bitnami/projects/sample
$ npm install

Start the application.

$ ./bin/www

This will start the Express server for your application on port 3000.

To access the application and see its output, browse to http://SERVER-IP:3000/. To end the application, terminate the running Express process.

NOTE: Access to the server on port 3000 may be blocked for security reasons. In this case, you must first create an SSH tunnel between your local system and the server before you can access the application using these instructions.

You can now proceed to enhance your project by connecting it with MongoDB or by adding AngularJS.

Connecting to MongoDB

You can connect your application with MongoDB using MongooseJS, an object modelling driver for Node.js. It is already installed in the MEAN stack so you only have to add the following lines to your app.js file: