MEAN.JS is a full-stack JavaScript solution that helps you build fast, robust and maintainable production web applications using MongoDB, Express, AngularJS, and Node.js. It is a great tool for framework for really accelerating your web development process making use of the MEAN stack.
Judging by the myriad of blog posts out there, it appears most of the developers out there using the MEAN stack are predominantly using MacBooks etc. However, this doesn't mean you can't develop using the mean stack on Linux. There are just a few tweaks you need to do to get it running.
Install MongoDB and Node.js on your ubuntu desktop;
[ebs_panel style="panel-info"] [ebs_panel-header] [ebs_icon type="glyphicon glyphicon-info-sign" color="#1e73be"] Update[/ebs_panel-header] [ebs_panel-content] In order to make life easier I have created a quick bash script to install all necessary components to get up and running with meanjs. After executing the bash script you can go directly to Get a project up and running with mean.js [wpdm_package id='5515'] [/ebs_panel-content] [ebs_panel-footer] [ebs_icon type="glyphicon glyphicon-question-sign" color="#1e73be"] How to execute BASH Scripts
[/ebs_panel-footer] [/ebs_panel]
In order to use the mean.js you will need to install the yeoman generator , which is a scaffolding tool for web applications. Yeoman helps you kickstart new projects, prescribing best practices and tools to help you stay productive.
sudo npm install -g generator-meanjs
This is will install the generator and you're almost ready to install Mean.js, however in order to get yeoman to work on your ubuntu machine there is one little hack you need to do. Yeo man needs to run using your superuser permissions, so you need to create a bash script for it to do so.
echo prefix = ~/.node >> ~/.npmrc echo 'export PATH=$HOME/.node/bin:$PATH' >> ~/.bashrc . ~/.bashrc
Once you've done that you can run simply run the yeoman generator,
yo meanjs
Install Ruby
sudo apt-get install ruby-full
Install Sass
sudo su -c "gem install sass"
Get a project up and running with mean.js
Although we have completed a few basics on how to generate a project with mean.js, there as still a few little quirks to remove friction points on your ubuntu desktop. I'll guide you through a process of how I successfully got this to work.
I'll create a little demo project and use my favourite IDE WebStorm by jetbrains
First step is step is to create a directory for your project and then change directory
mkdir meanjsdemo && cd meanjsdemo
Secondly generate your meanjs project
yo meanjs
The generator will now start and you will need to answer some basic questions about your application.
Complete your basic questions with relevant details
The generation should now complete
You can now open you project in WebStorm
You now need to open your terminal window in WebStorm ( alt + f12)
Just check your npm version to ensure you have he latest version , at the time this was 1.4.28
npm --version
Now install the bower based dependencies into your project, you may need to install bower globally first.
npm install sudo npm install -g bower bower install
now you should be able to run grunt and start the website
grunt
Open your browser and navigate to http://localhost:3000 , you should see the default generated for you.
The guys over at meanjs.org have put together a great video tutorial explaining how to use mean.js. I recommend watching this, not only is it entertaining in a geek way, but it is also has some very useful tips!
Mean.js also has some really good documentation to read to get you up to speed. Check it out on http://meanjs.org/docs.html#overview
Have fun playing around with mean.js and please do let me know if you have any more questions or even if you have some additional tips, in the comment section below.
- How to add RSS feed to nuxt 3 - September 25, 2023
- What is Middleware in Dotnet - September 19, 2023
- How to create a WebSocket server in dotnet - September 11, 2023