Node Version Manager install - nvm command not found

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

    All answers to this questions are useful. Especially the answer given by Travis helped me. For Mac OS X users I would like to provide some steps which will help them to work with the fresh installation of Node Version Manager a.k.a. nvm.

    Installing & using nvm on Mac OS X

    Here are the steps for fresh installation of nvm and using it without any issue:

    • Install homebrew from here.
    • Using homebrew install nvm

      brew update brew install nvm

    • Create .nvm directory at ~/.nvm location.

      mkdir ~/.nvm

    • Now if you don't have .bash_profile file setup for OS X terminal then please create a .bash_profile at the root level:

      nano ~/.bash_profile

    • Paste below code in the .bash_profile and press CTRL + O and press enter to save .bash_profile file. Press CTRL + X to exit from editor:

      export NVM_DIR=~/.nvm source $(brew --prefix nvm)/nvm.sh

    • Now either quite (CMD + Q) the terminal or run below command to load .bash_profile settings:

      source ~/.bash_profile

    • Now run nvm ls command to get the list of all installed nodejs versions.

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

    If you are using OS X, you might have to create your .bash_profile file before running the installation command. That did it for me.

    Create the profile file

    touch ~/.bash_profile
    

    Re-run the install and you'll see a relevant line in the output this time.

    => Appending source string to /Users/{username}/.bash_profile

    Reload your profile (or close/re-open the Terminal window).

    .  ~/.bash_profile
    
    0 讨论(0)
  • 2020-11-30 16:26

    First add following lines in ~/.bashrc file

    export 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
    

    then open terminal and source the nvm.sh script

    source ~/.nvm/nvm.sh
    
    0 讨论(0)
  • 2020-11-30 16:29

    For the issue was fixed when I moved

    export 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
    

    to the end of .zshrc

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

    source ~/.nvm/nvm.sh Add this line to ~/.bashrc, ~/.profile, or ~/.zshrc

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

    In macOS, i had to source it using source ~/.nvm/nvm.sh command to fix this problem.

    After that, add these lines

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

    onto ~/.bash_profile so that nvm will be sourced automatically upon login.

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