0%

国内服务器安装 Nvm

  • 系统:腾讯云 Ubuntu20.04.1 LTS
  • 软件:Nvm v0.40.1

安装 Nvm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
sudo apt update

# 无法访问github,使用gitee镜像git仓库
# git clone https://github.com/nvm-sh/nvm.git
git clone https://gitee.com/taohel/nvm.git

# 进入目录并安装
cd nvm

./install.sh

# 应用环境变量
source ~/.bashrc

# 安装完成
nvm -v

Nvm 设置源并安装 Node.js

1
2
3
4
5
6
7
8
# nvm 修改源
export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node/

# 安装 node.js 20^
nvm install 20

# npm 修改源
npm config set registry https://registry.npmmirror.com