安装npm和nodejs

1、获取nodejs 资源

  1. curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -

2、安装

  1. yum install -y nodejs
yum install -y nodejs

测试是否安装成功

  1. node -v
  2. # v4.4.0
  3. npm -v
  4. # 2.14.20
 node -v 

 # v4.4.0

npm -v

# 2.14.20

3、安装cnpm

  1. npm install -g cnpm --registry=https://registry.npm.taobao.org
npm install -g cnpm --registry=https://registry.npm.taobao.org