天天看點

linux使用yum安裝nodejs

1、安裝源

curl -sL https://rpm.nodesource.com/setup_12.x | bash -

2、開始安裝

yum -y install nodejs

3、node -v  和npm -v 檢視版本,說明安裝成功

4、替換為淘寶npm鏡像

首先我們可以檢視原本的鏡像位址:

npm get registry
https://registry.npmjs.org/      

5、替換成淘寶的:

npm config set registry http://registry.npm.taobao.org/

如果想恢複原來的鏡像位址:npm config set registry https://registry.npmjs.org/