一、下载包
https://registry.npmmirror.com/binary.html?path=node/
比如:10.9.0
https://registry.npmmirror.com/binary.html?path=node/v10.9.0/
按需下载
https://registry.npmmirror.com/-/binary/node/v10.9.0/node-v10.9.0-linux-x64.tar.gz
二、上传到服务器解压、安装
#复制压缩包
cp /mnt/f/迅雷下载/node-v10.9.0-linux-x64.tar.gz /usr/local
#进入目录
cd /usr/local
#加压压缩包
tar xf node-v10.9.0-linux-x64.tar.gz
#查看压缩包
ls
#重命名文件夹
mv node-v10.9.0-linux-x64 node
ls
cd node
ls
cd bin
history
#配置环境变量
vi ~/.bashrc
#配置文件末尾输入
export NODEJS_HOME=/usr/local/node/bin
export PATH=$NODEJS_HOME:$PATH
#刷新配置
source ~/.bashrc
#验证
node -v
npm -v
三、配置国内源
// 查询源
npm config get registry
// 更换国内源
npm config set registry https://registry.npmmirror.com
// 恢复官方源
npm config set registry https://registry.yarnpkg.com
// 删除注册表
npm config delete registry