1、下载压缩包
https://registry.npmmirror.com/binary.html?path=node/latest-v16.x/
2、解压
tar -zxvf node-v16.20.0-linux-x64.tar.gz
3、配置环境变量
vim /etc/profile
在末尾加上
export NODE_HOME=/home/local/nodejs/node-v16.20.0-linux-x64
export PATH=PATH
source /etc/profile
4、检查安装是否成功
node -v
npm -v
5、配置淘宝镜像
npm config set registry https://registry.npmmirror.com