1、CentOS7 安装Node12.16.2 # 准备编译环境yum -y install gcc gcc-c++ openssl-devel# 切换目录cd /usr/local# 下载Node12.16.2压缩包wget http://nodejs.org/dist/v12.16.2/node-v12.16.2-linux-x64.tar.gz# 解压tar -zxvf node-v12.16.2-linux-x64.tar.gz# 重命名文件夹mv node-v12.16.2-linux-x64 node 添加环境变量 # 编辑文件vim ~/.bashrc# 添加export PATH=$PATH:/usr/local/node/bin# 更新生效source ~/.bashrc# 验证环境node -v 设置淘宝npm源 # 设置npm源npm config set registry https://registry.npmmirror.com# 验证源npm config get registry# npm替换为cnpmnpm install -g cnpm --registry=https://registry.npmmirror.com