build node and npm on linux from git repo

First installs the git and other build tool, then checkout node repository from github. cd into the node folder, and checkout the version of git that you want to install, the version number for the latest stable version can be found from the nodejs.org, then run the configure and make and install.

sudo yum install git gcc-c++ make openssl-devel java-1.7.0-openjdk-devel
git clone git://github.com/joyent/node.git
cd node
git checkout v0.10.29
./configure
make
sudo make install

After the node is stalled, it’s usually installed in /usr/local/bin/node, and you might run into issue where the node command is not found when installing the npm because npm installs as nobody so it won’t look into the folder /usr/local/bin/ for node. A remedy for this is to make a symbolic link in /usr/bin/node

which node
ln -s /usr/local/bin/node /usr/bin/node

Go back to the home directory, git clone the npm repo from github, cd into the npm directory and make install.

cd
git clone https://github.com/isaacs/npm.git
cd npm
sudo make install

Search within Codexpedia

Custom Search

Search the entire web

Custom Search