How can the default node version be set using NVM?

后端 未结 5 985
执笔经年
执笔经年 2020-12-04 07:48

I have installed nvm (ubuntu with zsh shell) with two node version: v6.11.5 and v9.0.0 and the default version in nvm is the v9.0.0

Every time I need to change the

相关标签:
5条回答
  • 2020-12-04 08:08

    Lets say to want to make default version as 10.19.0.

    nvm alias default v10.19.0
    

    But it will give following error

    ! WARNING: Version 'v10.19.0' does not exist.
    default -> v10.19.0 (-> N/A)
    

    In That case you need to run two commands in the following order

    # Install the version that you would like 
    nvm install 10.19.0
    
    # Set 10.19.0 (or another version) as default
    nvm alias default 10.19.0
    
    0 讨论(0)
  • 2020-12-04 08:09

    change the default node version with nvm alias default 10.15.3 *

    (replace mine version with your default version number)

    you can check your default lists with nvm list

    0 讨论(0)
  • 2020-12-04 08:10

    This will set the default to be the most current version of node

    nvm alias default node
    

    and then you'll need to run

    nvm use default
    

    or exit and open a new tab

    0 讨论(0)
  • 2020-12-04 08:12

    (nvm maintainer here)

    nvm alias default 6.11.5 if you want it pegged to that specific version.

    You can also do nvm alias default 6.

    Either way, you'll want to upgrade to the latest version of nvm (v0.33.11 as of this writing)

    0 讨论(0)
  • 2020-12-04 08:31

    You can also like this:

    $ nvm alias default lts/fermium
    
    0 讨论(0)
提交回复
热议问题