安装命令:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
出现的问题,其实错误信息已经告诉我们解决方法了
=> nvm is already installed in /Users/qxian/.nvm, trying to update using git
=>
=> Profile not found. Tried (as defined in $PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile.
=> Create one of them and run this script again
=> Create it (touch ) and run this script again
OR
=> Append the following lines to the correct file yourself:
export NVM_DIR="/Users/qxian/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
=> Close and reopen your terminal to start using nvm
解决方法是新建个.bash_profile文件
qxiandeMacBook-Pro:~ qxian$ touch .bash_profile
新建完文件后,再次执行安装命令
qxiandeMacBook-Pro:~ qxian$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7766 100 7766 0 0 3422 0 0:00:02 0:00:02 --:--:-- 3424
=> nvm is already installed in /Users/qxian/.nvm, trying to update using git
=>
=> Appending source string to /Users/qxian/.bash_profile
=> Close and reopen your terminal to start using nvm
自此,npm安装成功!