1.下载安装nodejs
wget http://nodejs.org/dist/v7.4.0/node-v7.4.0.tar.gz
yum install gcc openssl-devel gcc-c++ compat-gcc- compat-gcc--c++
tar -xf node-v7.4.0.tar.gz
cd node-v7.4.0
./configure --prefix=/usr/local/node
make && make install
ln -s /usr/local/node/bin/* /usr/sbin/
2.配置npm
npm set prefix /usr/local
echo -e '\nexport PATH=/usr/local/lib/node_modules:$PATH' >> ~/.bashrc
source ~/.bashrc