Note
This is post from 2014, nowadays I'd probably use docker and install npm stuff in docker container.
Sometimes you need to install some node modules, but every tutorial says: "Do sudo npm install -g something. I don't like to mix sudo and downloading some stuff from unsecure location. There is a very easy way to install such modules in a easy way.
First compile nodejs locally to .local folder.
- Download/untar node js. Let's say it is in /tmp/node
- Create directory named "$HOME/.local" (or any other really)
- cd /tmp/node
- configure --prefix="$HOME/.local
- make && make install
Now you have a working installation of node in $HOME/.local/bin, add this directory to PATH and you'll be able to install modules "globally" to your home folder, for example:
npm install -g coffee-script
and coffee will be accessible from $HOME/.local/bin.
Note
I used this for inspiration.