Node Version Manager install - nvm command not found

后端 未结 26 1552
名媛妹妹
名媛妹妹 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:32

    Add the following lines to the files ~/.bashrc and ~/.bash_profile :

    # NVM changes
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
    

    and restart the terminal or do source ~/.bashrc or source ~/.bash_profile. If you need command completion for nvm then also add the line:

    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
    

    Along with the above lines to ~/.bashrc and ~/.bash_profile.

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

    I had fixed this problem.

    1. touch ~/.bash_profile
    2. open ~/.bash_profile
    3. pasteexport NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
    0 讨论(0)
  • 2020-11-30 16:34

    For me this worked. First check that the file .bashrc has following line

    [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

    Now bashrc is loaded for each terminal session. Thus restart the terminal so that it is loaded again and you should be good to go.

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

    For MacOS;

    Run on Terminal >

    open ~/.bash_profile
    

    Paste all of this=

    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
    
    0 讨论(0)
  • 2020-11-30 16:40

    After trying multiple steps, not sure what was the problem in my case but running this helped:

    touch ~/.bash_profile
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
    

    Verified by nvm --version

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

    I think you missed this step:

    source ~/.nvm/nvm.sh
    

    You can run this command on the bash OR you can put it in the file /.bashrc or ~/.profile or ~/.zshrc to automatically load it

    https://github.com/creationix/nvm

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