1.官方推荐的安装方法
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
2.此时nvm 已经安装好了
当你执行nvm时很有可能nvm:command not found
此时查看是否有 ~/.bash_profile这个文件
如果没有就touch ~/.bash_profile
open ~/.bash_profile
然后添加
export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
保存,此时要注意上面那个配置语句不能直接copy这个应该是你进行第一步时给你提示的有语句,copy paste就可以了
3.最后一步 立即使上面的配置文件生效 source ~/.bash_profile 此时所有工作做完了,运行一下nvm是不是出现了你想看到的输出