yum install -y wget
ndoejs 官网:https://nodejs.org/en/download/
选择 LTS 下载即可
wget https://nodejs.org/dist/v14.16.0/node-v14.16.0-linux-x64.tar.xz
下载好后解压
xz -d node-v14.16.0-linux-x64.tar.xz
tar -xf node-v14.16.0-linux-x64.tar
移动 nodejs 到 /usr/local,文件夹重名为 nodejs
mv node-v14.16.0-linux-x64 /usr/local/
cd /usr/local/
mkdir nodejs
mv node-v14.16.0-linux-x64/* nodejs
cd /usr/bin
ln -s /usr/local/nodejs/bin/node node
ln -s /usr/local/nodejs/bin/npm npm
ln -s /usr/local/nodejs/bin/npx npx
https://blog.csdn.net/qq_25231683/article/details/120762573
[root@yisu-5fbf6b8f8c1dd bin]# cd ~
[root@yisu-5fbf6b8f8c1dd ~]# node -v
v14.16.0
[root@yisu-5fbf6b8f8c1dd ~]# npm -v
6.14.11
[root@yisu-5fbf6b8f8c1dd ~]# npx -v
6.14.11
查看原来镜像地址
npm get registry
切换成淘宝源
npm config set registry http://registry.npm.taobao.org/
切换回默认源
npm config set registry https://registry.npmjs.org/
安装 cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org