inter芯片Mac安装NVM管理Node.js版本
- macOS安装homebrew
# 终端输入
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- 使用brew安装nvm
# 终端输入
brew install nvm
- 配置nvm环境变量
# 终端输入
vim ~/.zshrc
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# 终端输入
source ~/.zshrc
- 修改NVM权限
提示
zsh compinit: insecure directories, run compaudit for list. Ignore insecure
compaudit
sudo chown -R root:staff /usr/local/share/zsh
sudo chmod -R 755 /usr/local/share/zsh
安装指定版本Node.js
nvm install 16.15.0
转载自:https://segmentfault.com/a/1190000041870257