安裝命令:git
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
出現的問題,其實錯誤信息已經告訴咱們解決方法了github
=> 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文件npm
qxiandeMacBook-Pro:~ qxian$ touch .bash_profile
新建完文件後,再次執行安裝命令bash
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安裝成功!curl