blog:nodejs:nvm
这是本文档旧的修订版!
使用 NVM 管理 macOS nodejs 版本
安装
1. 通过 brew 安装
brew install nvm
2. 通过 curl 安装
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
配置
添加两行配置文件到你的 ~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc 文件,然后 source ~/.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
使用
# 安装 nvm install 16 nvm install --lts --default # 启用 nvm use 16 nvm use --lts nvm use default # 配置全局 node nvm alias default 16 nvm alias default node # 查看本地安装版本 nvm ls
blog/nodejs/nvm.1671605413.txt.gz · 最后更改: 由 Where.Liu
