cd /opt/soft
wget https://cdn.npmmirror.com/binaries/node/v16.15.1/node-v16.15.1-linux-x64.tar.xz
tar -xvf node-v16.15.1-linux-x64.tar.xz
mv node-v16.15.1-linux-x64 nodejs-v16.15
#建立软连接
ln -s /opt/soft/nodejs-v16.15/bin/node /usr/bin/node
ln -s /opt/soft/nodejs-v16.15/bin/npm /usr/bin/npm
#查看是否安装成功
root@pc:/opt/soft# node -v
v16.15.1
#设置淘宝源
npm config set registry https://registry.npm.taobao.org
#查看是否修改成功
npm config get registry
#==================== 安装pnpm ===================
#1.获取脚本执行脚本
wget -qO- https://get.pnpm.io/install.sh | sh -
#2.使变量生效
source /root/.bashrc
//查看源
pnpm config get registry
//切换淘宝源
pnpm config set registry https://registry.npmmirror.com/