Node is a javascript based server that allows to run javascript based applications in your computer without having to open or use any browser. This means that javascript applications can be run as desktop apps.
You may now wonder why would anyone want to do that, but in any case, I’m not saying you have to build any JS app, actually, there are plenty of them already developed that you can benefit from, you only need to install node.js and start installing and running them. Those tools by the way, are mainly helpers to build your websites… in javascript. Which has a lot of sense, as many applications are now going into Knockout, Ember or AngularJS, which means client-side presentation apps made in javascript. So we are going to have javascript helpers to build javascript applications, and to run those javascript tools in our computer we need to install Node.js, a Javascript based server.
Installation
Please download the installer (.msi) from their downloads page. There’s also an .exe but it didn’t work very well to me.
You need to install it as an admin, so open cmd as admin then go to the folder where the msi is downloaded and exec it (just write its name). That should install node.
Once node.js is installed another tool is installed with it, that tool is Node Package Manager (npm), and you can run it from the console just calling it with “npm command“.
Installing other tools
There are many tools or plugins that you can install using npm, they all run over node.js though you won’t see much of node.js yourself, you will probably work with npm only to manage your installed tools.
Now, some of those tools are more global, like Yeoman (which is a websites builder, just to help you generating templates to start a new website) or Grunt (which is a builder to build your site and concatenate stylesheets, scripts, etc.), while others will be more interesting in a “local” installation (which means, only the project in which you installed it can make use of it).
Let’s see how to use both of them:
Installing tools globally with npm
To install a tool globally so that you can access it from anywhere in your computer just open cmd (I recommend you to do that as Admin as you are going to install stuff) and write this:
npm install -g yo
Make sure you write that -g which is what tells npm to install it globally. Installing stuff globally is as simple as that, now, you can call yeoman from anywhere in your computer by just typing “yo” in the console. Don’t do it! Yeoman is a generator, if you run it, it will generate a website in the folder you are, so don’t call Yeoman on any folder, just where you want to build a website
Installing tools locally with npm
Now, if you want to install some tool locally on a project, like Karma (to test the project), you only need to move to that project’s main folder with the console (cd…) and execute a command like this:
npm install --save karma
Which will allow you to use karma, but only in that project. This is, if you now execute the command “karma init” inside that project karma will prompt you the configuration questions, if you run it elsewhere it won’t work as it isn’t installed globally.