Linux系统如何安装node管理器
2020/5/3...小于 1 分钟
- 安装github
Centos
yum install git -yUbuntu
apt install git -y- 安装node.js管理器等组件
git clone https://github.com/creationix/nvm.git ~/nvm
# 设置nvm 自动运行
echo "source ~/nvm/nvm.sh" >> ~/.bashrc
source ~/.bashrc
# 查看所有版本(部分环境可能不支持最高版本)
nvm list-remote
# 安装npm的最新版本
nvm install stable
# 使用最新版本
nvm use stable使用国内镜像
- 对于国内而言,访问外网是很困难的,这会导致访问速度很慢,而国内镜像就很重要了
node 国内镜像
export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/nodenpm 国内镜像
npm config set registry https://registry.npmmirror.comnpm WIN 国内镜像源
npm config set registry https://registry.npmmirror.com --global
npm config set disturl https://npmmirror.com/mirrors/node --globalyarn 安装
启用yarn
Node.js >=16.10
corepack enableNode.js <16.10
npm i -g corepack安装 yarn
corepack prepare yarn@stable --activate
# 指定版本安装yarn
corepack prepare yarn@<version> --activate