I was having lots of difficulties to install node.js / npm on a server running CentOS 5. The node.js documentation mentions that we should be adding the EPEL repository and then using “yum install npm” to install it. However, no matter how much I tried, this package seems unavailable on CentOS 5. Compiling from source was a solution but I really did not want to install all the development tools on that machine that is essentially just a testing server. All I needed node.js for was to run tests from the mocha test framework.
After much research I finally found an answer on serverfault (a branch of StackOverflow). It suggests to use nave, a virtual environment for node that will install npm and node.js just for the local user. Turns out this is exactly what I wanted since it would simplify the migration if I need to move my testing environment to another server.
Commands in the console:
wget https://raw.github.com/isaacs/nave/master/nave.sh
chmod +x nave.sh
./nave.sh install stable
./nave.sh use stable
(You could replace stable with a specific node version number)
And that’s all! node and npm are available from this specific user, no need to compile node from source to use it from CentOS.
4 replies on “How I found a way to install node.js & npm on CentOs 5”
thanks! time saver.
Silly question! Where does Node get installed. I’m using CentOS 5.* and the installation seems to have gone through successfully with the default options from nave.
You can always do “whereis node” to know where it was installed.
Thanks, nice quick way to use node!
‘which node’ points out where the binary is… on my system that is ~/.nave/installed/0.10.25/bin/node
The ‘global’ nodes_modules for this installation go to ~/.nave/installed/0.10.25/lib/node_modules