下载官网node的包
wget https://nodejs.org/download/release/latest-v17.x/node-v17.9.1-linux-x64.tar.gz
解压到opt目录
tar -zxvf node-v17.9.1-linux-x64.tar.gz -C /opt/
配置软连接
ln -s /opt/node-v17.9.1-linux-x64/bin/node /usr/local/bin/node
ln -s /opt/node-v17.9.1-linux-x64/bin/npm /usr/local/bin/npm
验证
[root@test ~]# node -v
v17.9.1
[root@test ~]# npm -v
8.11.0
配置taobao加速
npm config set registry https://registry.npm.taobao.org --globa
npm config set disturl https://npm.taobao.org/dist --global
[root@test ~]# npm config get registry
https://registry.npm.taobao.org/