Node Version Manager install - nvm command not found

后端 未结 26 1494
名媛妹妹
名媛妹妹 2020-11-30 16:18

I am trying to install NVM as per these instructions

I typed in this command in terminal:

$ curl https://raw.github.com/creationix/nvm/master/instal         


        
相关标签:
26条回答
  • 2020-11-30 16:50

    Had the same problem, but this worked for me:

    Since macOS 10.15, the default shell is zsh and nvm will look for .zshrc to update, none is installed by default. Create one with touch ~/.zshrc and run the install script again.

    more info here: Troubleshooting on macOS

    0 讨论(0)
  • 2020-11-30 16:51

    Quick answer

    Figure out the following:

    1. Which shell is your terminal using, type in: echo $0 to find out (normally works)
    2. Which start-up file does that shell load when starting up (NOT login shell starting file, the normal shell starting file, there is a difference!)
    3. Add source ~/.nvm/nvm.sh to that file (assuming that file exists at that location, it is the default install location)
    4. Start a new terminal session
    5. Profit?

    Example

    As you can see it states zsh and not bash. enter image description here

    To fix this I needed to add source ~/.nvm/nvm.sh to the ~/.zshrc file as when starting a new terminal my Deepin Terminal zsh reads ~/.zshrc and not bashs ~/.bashrc.

    Why does this happen

    This happens because when installing NVM it adds code to ~/.bashrc, as my terminal Deepin Terminal uses zsh and not bash it never reads ~/.bashrc and therefor never loads NVM.

    In other words: this is NVMs fault.

    More on zsh can be read on one of the answers here.

    0 讨论(0)
提交回复
热议问题