Mac OS 正确安装nvm的方法

1,747 阅读1分钟

安装

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

添加.bash_profile

nvm command not found

在Finder中的根目录下找到.nvm文件夹,这个文件夹是隐藏的。

显示隐藏文件:

defaults write com.apple.finder AppleShowAllFiles -bool true killall Finder

关闭隐藏文件:

defaults write com.apple.finder AppleShowAllFiles -bool false killall Finder

在文件夹下右键打开终端并输入代码:

touch .bash_profile
open .bash_profile

粘贴下面的内容输入:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

保存文件,继续执行命令

source .bash_profile