1、获取nodejs 资源
# 4.x
curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
# 5.x
curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
2、安装
yum install -y nodejs
测试是否安装成功
node -v
# v4.4.0
npm -v
# 2.14.20
npm的另一种安装方式是
- wget http://npmjs.org/install.sh
- chmod +x ./install.sh
- ./install.sh