Installing Node.js, NPM, Grunt, and Yeoman in Ubuntu 14.04 LTS

Installing Node.js is not as difficult as a year ago. You can simply install it through your Terminal. First get the installer.

$ curl -sL https://deb.nodesource.com/setup | sudo bash -

And then install it with apt-get.

$ sudo apt-get install -y nodejs

You can check your Node.js version by typing node -v in your terminal window.

NPM

Node Package Manager is automatically installed after Node.js installation. You can access it through npm command in terminal. To check the version, type npm -v.

NPM Global Package

You can install package as global using -g directive. For example if you want to install Grunt, the javascript task runner, you can type:

$ sudo npm install -g grunt-cli

So, you can type grunt wherever you are. We can do this to install Yeoman.

NPM Local Package

After you learn to install the package globally, you must be wanted to know about how to install the package locally. First go to your project directory:

$ cd /path/to/your/project-directory

and then install the package, in this example we use grunt-contrib-watch package:

$ npm install grunt-contrib-watch

If you want to install and then add the package as devDependencies in your package.json, you can add the --save-dev option:

$ npm install grunt-contrib-watch --save-dev

Yeoman

I don’t know what it is Yeoman, I mean I don’t know how to explain. You better go see it yourself. To install Yeoman you can type.

$ sudo npm install -g yo

Yes, we have to install it globally because later we have to type yo without sudo to install generator. To install the generator, in this case generator-webapp, we can use this command.

$ sudo npm install -g generator-webapp

You can search other generators in Yeoman generator list

Use Yeoman as Scaffolding Tool

Yeah, I just remember what Yeoman used for, it has been created to help website developer to scaffold their project. How?

$ yo webapp

Patience is needed to get the required files.

Leave a Reply