Windows安装:
1、详情参考:https://blog.csdn.net/goods_yao/article/details/137854626
本文详细介绍了在Windows系统中使用nvm(NodeVersionManager)管理Node.js版本的过程,包括卸载Node.js、nvm的安装与配置、修改npm镜像源、环境变量设置及常见问题解决。
Linux(centos7.6)安装:
0、机器上没有安装过node ,或者彻底卸载干净
1、脚本自动安装
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
或
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
2、curl报443错误,wget无响应,修改hosts
vi /etc/hosts
末尾加入如下内容:
151.101.8.133 raw.githubusercontent.com
3、再次执行wget下载安装脚本
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
4、关闭当前ssh连接,新开ssh,执行
nvm ls-remote
一直无响应,解决办法如下:
vim ~/.bashrc
末尾加入(nvm阿里云镜像地址):
export IOJS_ORG_MIRROR=https://npmmirror.com/mirrors/iojs
export NODIST_IOJS_MIRROR=https://npmmirror.com/mirrors/iojs
export NVM_IOJS_ORG_MIRROR=https://npmmirror.com/mirrors/iojs
export NVMW_IOJS_ORG_MIRROR=https://npmmirror.com/mirrors/iojs
export NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node
export NODIST_NODE_MIRROR=https://npmmirror.com/mirrors/node
export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node
export NVMW_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node
export NVMW_NPM_MIRROR=https://npmmirror.com/mirrors/npm
让配置生效:
source ~/.bashrc
5、安装node16.10.0
nvm install 16.10.0
6、执行node -v 和npm -v ,返回版本号
标签:mirrors,windows,MIRROR,https,Linux,nvm,npmmirror,com From: https://www.cnblogs.com/liaosenlin/p/18404908