One problem I face on my University's computer is that I do not have root rights and the space in the (synchronized) home directory is quite small. Installing node.js is not possible without exceeding my quote. So I had to install it locally!
In the following I assume that you want to install node.js to /temp_local/node. If that is not correct then replace it by a different directory name!
Let's start by doing some initial configuration:
echo 'root = /temp_local/node/lib/node_modules' >> ~/.npmrc echo 'binroot = /temp_local/node/bin' >> ~/.npmrc echo 'manroot = /temp_local/node/share/man' >> ~/.npmrc
Now we create the directory where we will install node.js and go to the parent directory of this one.
mkdir /temp_local/node cd /temp_local
In the next step we download the latest version of node.js and extract it. After the installation we could also remove the directory, but it is always good to keep the source.
curl http://nodejs.org/dist/node-latest.tar.gz tar xf node-latest.tar.gz cd node-latest
Finally we are ready for the installation. The most important part is to get the
prefix argument right.
./configure --prefix=/temp_local/node make make install
After the installation we just have to do some configuration like setting up the right lookup directory or exporting the path to node.
ln -s /temp_local/node/lib/node_modules ~/.node_modules echo 'export PATH=/temp_local/node/bin:$PATH' >> ~/.bashrc