Node Version Manager install - nvm command not found

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

    I also faced the same problem recently and sourcing nvm bash script by using source ~/.nvm/nvm.sh resolved this issue.

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

    OSX 10.15.0 Catalina (released November 2019) changed the default shell to zsh.

    The default shell was previously bash.

    The installation command given on the nvm GitHub page needs to be tweaked to include "zsh" at the end.

    curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | zsh
    

    Note: you might need to ensure the .rc file for zsh is present beforehand:

    touch ~/.zsrhrc
    
    0 讨论(0)
  • 2020-11-30 16:49

    The nvm install script by default adds initialization code to your $HOME/.profile, which is only loaded by a login shell (in a desktop environment you may never see a login shell).

    The nvm command in your login shell is not propagated to sub-shells (like console windows and IDE terminals after you log in). This snippet in your $HOME/.bashrc will only load nvm if it is an interactive shell and has not been loaded already

    # if nvm dir is not set and the standard nvm directory exists
    if [ -z "$NVM_DIR" -a -d "$HOME/.nvm" ] ; then
    # set nvm dir
      export NVM_DIR="$HOME/.nvm"
    fi
    
    # if nvm dir is set and this shell is interactive
    if [ -d "$NVM_DIR" -a -n "$PS1" ] ; then
      # if nvm command is not defined
      if ! type -t nvm >/dev/null ; then
        # set it
        source "$NVM_DIR/nvm.sh"
      fi
    fi
    

    Putting this in your $HOME/.bashrc file will fix the missing nvm problem in interactive bash shells, even from a gui, and even if nvm is installed in a non-standard location.

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

    Use following codes

    wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash`
    source ~/.nvm/nvm.sh`
    nvm install 0.8
    
    0 讨论(0)
  • 2020-11-30 16:50

    For Mac OS:

    1. Open Terminal
    2. Run touch ~/.bash_profile
    3. Run vi ~/.bash_profile
    4. Type source ~/.nvm/nvm.sh
    5. Press Shift + Esc and type wq and press enter
    6. Done.
    0 讨论(0)
  • 2020-11-30 16:50

    In Windows 8.1 x64 same happened with me, and received the following message.

    nvm install 8.3.0 bash: nvm: command not found windows

    So, follow or verify below following steps-

    first install coreybutler/nvm-windows from github.com. Currently available latest release 1.1.5 nvm-setup.zip, later extracted the setup nvm-setup.exe and install as following locations:

    NVM_HOME    : C:\Users\Administrator\nvm
    NVM_SYMLINK : C:\Program Files\nodejs
    

    and meanwhile setup will manage the environment variable to Path as above said for you.

    Now run Git Bash as Administrator and then.

    $ nvm install 8.3.0 all
    
    Downloading node.js version 8.3.0 (64-bit)...
    Complete
    Creating C:\Users\Administrator\nvm\temp
    
    Downloading npm version 5.3.0... Complete
    Installing npm v5.3.0...
    
    Installation complete. If you want to use this version, type
    
    nvm use 8.3.0
    
    $ nvm use 8.3.0
    Now using node v8.3.0 (64-bit)
    

    here run your command without using prefix $, it is just shown here to determine it as a command line and now we will verify the nvm version.

    $ nvm --version
    Running version 1.1.5.
    
    Usage:
    -----------------------
    

    if you have problem using nvm to install node, you can see this list of available nodejs releases here https://nodejs.org/download/release/ and choose the correct installer as per your requirement version equal or higher than v6.3.0 directly.

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