mac安裝nvm
在終端執(zhí)行安裝命令:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
安裝完成后關(guān)閉終端特愿,重新打開(kāi)終端輸入nvm驗(yàn)證一下是否安裝成功勋拟,當(dāng)出現(xiàn)“Node Version Manager”時(shí)贤壁,說(shuō)明已安裝成功。
如果在新的終端輸入nvm時(shí)提示:-bash nvm: command not found
你的系統(tǒng)可能缺少一個(gè).bash_profile文件狂男,你可以創(chuàng)建一個(gè)此文件
創(chuàng)建.bash_profile文件:
touch .bash_profile
打開(kāi)編輯文件.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
安裝成功