1. 程式人生 > >CentOS 通過yum安裝nodejs和npm

CentOS 通過yum安裝nodejs和npm

安裝

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