mac安裝nvm
在終端執(zhí)行安裝命令:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
安裝完成后關(guān)閉終端,重新打開終端輸入nvm驗證一下是否安裝成功,當(dāng)出現(xiàn)“Node Version Manager”時,說明已安裝成功。
如果在新的終端輸入nvm時提示:-bash nvm: command not found
你的系統(tǒng)可能缺少一個.bash_profile文件,你可以創(chuàng)建一個此文件
創(chuàng)建.bash_profile文件:
touch .bash_profile
打開編輯文件.bash_profile:
open -e .bash_profile
拷貝下面內(nèi)容到.bash_profile并保存:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
執(zhí)行:
source .bash_profile
最后:
nvm --version
安裝成功