NodeJs 学习

Nvm Node版本管理工具

1. 安装Nvm

MacOS安装

1.1 下载:

# curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
# wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

1.2 环境变量(vi .zshrc)

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

Windows安装

2. 使用Nvm

# 查看帮助文档
nvm -h

3. M1安装低版本NodeJs报错(error: "unsupported ARM architecture")

GitHub Issue: https://github.com/nvm-sh/nvm/issues/2350 (opens new window)
解决办法,先运行下面的命令再执行:

arch -x86_64 zsh

Nrm Npm镜像管理

Last Updated: 9/30/2021, 4:06:52 PM