At the time of writing there exists this answer on the Webfaction forum on how to install nodejs but that procedure seems to be out of date so I’m documenting here how I did it.
Note that since in my case I did not need to install the express framework, I did not need to do the first step of installing a custom application. Also, precompiled binaries of nodejs are available for many platforms so there is no need to compile it which makes this process much easier than is outlined in the above procedure.
- SSH into your webfaction account.
- Create a directory for node and cd into it:
1$ mkdir nodejs && cd $_ - Get the node binaries for Linux:
1$ wget https://nodejs.org/dist/v4.2.3/node-v4.2.3-linux-x64.tar.gz - Extract it:
1tar -xzf node-v4.2.3-linux-x64.tar.gz - Use your favorite text editor to update the
PATH
environment variable in your.bash_profile
file to include the path to the node executables. In this case you would add the following line:
1PATH=$PATH:$HOME/nodejs/node-v4.2.3-linux-x64/bin
This line should come before the line containingexport $PATH
. - Log out and log back in. You should now have
node
andnpm
on yourPATH
.
This procedure is so simple and obvious to a seasoned Linux user that it is hardly worth documenting, but it’s different enough from the procedure outlined by Webfaction that I felt it was justified to do so.