The procedure that worked for me (following these rather old instructions with a few updates):
git --version
or install it via:sudo yum install git
sudo yum install gcc-c++ make
sudo yum install openssl-devel
node
(which you can remove later):git clone https://github.com/nodejs/node.git
cd node
git checkout v6.1.0
- put your desired version after the v
./configure
make
sudo make install
node --version
or simply node
(exit node via process.exit()
or ^C
x 2 or ^C
+ exit
) npm --version
and update if necessary via sudo npm install -g npm
node
directory with rm -r node
Notes:
sudo yum install nodejs --enablerepo=epel-testing
returns the error: No package nodejs available.
sudo yum install nodejs --enablerepo=epel
(ie without -testing
) only gave very old versions.sudo npm uninstall npm -g
...since npm can uninstall itselfsudo yum erase nodejs
sudo rm -f /usr/local/bin/node
sudo yum rm nodejs
in the accepted answer won't work as rm
is not a valid yum command see yum --help
)git clone git://github.com/nodejs/node.git
rather than git clone https://github.com/nodejs/node.git
but you may get a various errors (see here)./node
dir from a previous install, remove it before using the git clone command (or there'll be a conflict):rm -r node
sudo npm...
command - like sudo: npm: command not found
and/or have permissions issues installing node packages without sudo, edit sudo nano /etc/sudoers
and add :/usr/local/bin
to the end of the line Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
so that it reads Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin