Open SunXinFei opened 6 years ago
nvm方便我们对nodejs进行版本的切换,nvm的github项目地址里面有windows的安装下载链接,主要是mac本这里,注意先删除干净所有的node的文件,然后运行github中所提到的如下命令: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash 就会git克隆到本地,安装成功之后,运行nvm看看有没有提示信息,如果看到 nvm: command not found, 那么就需要我们如下运行命令: 创建bash_profile 执行命令: touch .bash_profile 打开并编辑bash_profile 执行命令: open .bash_profile 这样我们就获得一个记事本打开的bash_profile,我们在里面粘贴上这个: export NVM_DIR=~/.nvm source ~/.nvm/nvm.sh 然后command+s保存,运行source命令: source .bash-profile 然后输入nvm就可以得到信息了,官方的github的readme中不能解决这个问题,我获得这个解决方案来自于issue中
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
nvm: command not found
创建bash_profile 执行命令: touch .bash_profile
打开并编辑bash_profile 执行命令: open .bash_profile
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
source .bash-profile
nvm在nodejs版本切换相比n的话,不够全局,n是直接全局的切换node版本,所以在一些项目对node有严格版本要求的时候,nvm的切换的版本会出现一些错误信息,所以建议使用n来切换,达到全局node版本的效果。
nvm方便我们对nodejs进行版本的切换,nvm的github项目地址里面有windows的安装下载链接,主要是mac本这里,注意先删除干净所有的node的文件,然后运行github中所提到的如下命令:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
就会git克隆到本地,安装成功之后,运行nvm看看有没有提示信息,如果看到nvm: command not found
, 那么就需要我们如下运行命令:创建bash_profile 执行命令: touch .bash_profile
打开并编辑bash_profile 执行命令: open .bash_profile
这样我们就获得一个记事本打开的bash_profile,我们在里面粘贴上这个:export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
然后command+s保存,运行source命令:source .bash-profile
然后输入nvm就可以得到信息了,官方的github的readme中不能解决这个问题,我获得这个解决方案来自于issue中