1下载:Node.js — Download Node.js®
2文件上传到服务器
root@localhost software]# tar xvf node-v20.12.2-linux-x64.tar.xz
[root@localhost software]# mv node-v20.12.2-linux-x64/ /usr/local/node
[root@localhost software]# vim /etc/profile
export PATH="$PATH:/usr/local/node/bin"
[root@localhost software]# source /etc/profile
3查看版本
4查看地址
[root@localhost software]# npm config get registry
https://registry.npmjs.org/
5配置淘宝新地址
[root@localhost software]# npm config set registry https://registry.npmmirror.com
[root@localhost software]# npm config get registry
https://registry.npmmirror.com
6如有npm install 时 certificate has expired 错误
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/supports-color/download/supports-color-2.0.0.tgz?cache=0&sync_timestamp=1611394023277&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdow
nload%2Fsupports-color-2.0.0.tgz failed, reason: certificate has expired
#关闭 npm ssl 证书检查
npm set strict-ssl false