[Yeoman] reblog – Install yeoman in Ubuntu 14.04

If you got the problem of installation yeoman in ubuntu 14, it’s better to read this blog:

By Andreas Vlachos :
In Ubuntu 14.04 (actually starting from 13.10) versions 0.10.x of nodejs are present in the official repositories. So in order to install nodejs package manager just type:

sudo apt-get install npm nodejs-legacy

npm alone is not sufficient to install Yeoman, since the latter depends on ‘node’ legacy binary during installation, hence nodejs-legacy package is also required.
Install global npm packages as a regular user.
npm installs packages under a ‘prefix’ configuration variable, which defaults to /usr/lib in Ubuntu 14.04. In order to avoid using sudo for every npm-install command, you may configure ‘prefix’ variable to point into a user local directory.

sudo npm set prefix '$HOME/[your_npm_directory]' --global

Verify that setting has been set using; defaults to /usr/lib

sudo npm get prefix

Update your $PATH variable to include the location npm installs binaries,

echo "export PATH=$PATH:$HOME/dev/npm/bin" >> $HOME/.profile

and restart your terminal session.
Install Yeoman :

npm install -g yo

as mentioned in the official site.
AngularJS scaffolding
Install angularJS generator

npm install -g generator-angular

Generate angularJS application

yo angular

Invoke grunt to build the application grunt serve (or python -m SimpleHTTPServer) to preview the application.

[NodeJS] upgrade NodeJS with npm

Normally, it is a little boring to generate versions. Today I want to install sails.js, when I do “sudo npm -g install sails”, it displays several WARN in red, don’t be afraid, there are some command to upgrade your node with npm to the last version or the version that you want.

sudo npm cache clean -f   # Clear your npm cache
sudo npm install -g n     # Install "n" which is node binary module
sudo n stable

you could specify a desired version:

sudo n 0.8.21