Hi Luca,
Yes.. unfortunately Ubuntu 12.04's npm and nodejs installs haven't been updated in a while. I faced the same issue once and had to do the same commands you mention. However, following a move to Ubuntu 14.04 (which is nicely kept up to date) everything installs right out of the box as per the adapt learning install instructions without error.
Depending on your security (my ubuntu install is just for my personal dev work), you may wish to run chmod (i like a nice destructive approach of 777!) both across npm and grunt to avoid typing sudo. Depending on where in your directory structure you build your course, Grunt writes files and can be blocked without a user-friendly error (hinting you need to use sudo) this has caught me 1-2 times.
All the best,
Wes