Some experience about using NVS

Recently, I started a new personal project. The code compilation requires a lower version of node. Uninstalling the current node and reinstalling it, and then resetting the environment variables is obviously not a flexible solution. I fell into the arms of NVS .

Because I am a windows system, I will only talk about the installation and use experience in this environment.

  1. Download nvs
    to the NVS release page of the Github code warehouse . Each release version has corresponding Release Notes and different types of download resources Assets . I chose the latest version v.1.6.0 . Go to Assets and click nvs-1.6.0.msi , and choose to save the file in the pop-up window


  2. After the installation nvs download is complete, click the .msi file to complete the installation

  3. GitBash environment configuration

  • Create a new .bash_profile file in the user folder and add the following code

    if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
    
  • Create a new .bashrc file in the same file path and add the following code

    export NVS_HOME=$LOCALAPPDATA/nvs
    . $NVS_HOME/nvs.sh
    

    In my environment, $LOCALAPPDATA=C:/Users/Xiayidan/AppData/Local

  1. User command line (CMD) environment configuration
  • To define the installation path, run the following command
    for single-user installation:
    set NVS_HOME=%LOCALAPPDATA%\nvs
    
    During system installation:
    set NVS_HOME=%ProgramData%\nvs  
    
  • Install, run the command
    "%NVS_HOME%\nvs.cmd" install
    
  1. PowerShell environment configuration
  • To define the installation path, run the following command
    for single-user installation:
    $env:NVS_HOME="$env:LOCALAPPDATA\nvs"
    
    During system installation:
    $env:NVS_HOME="$env:ProgramData\nvs"  
    
  • Install, run the command
    . "$env:NVS_HOME\nvs.ps1" install
    
  1. After using nvs
    to perform the above steps, you can open any shell terminal, use the nvs command line to add, delete different versions of Node, and switch at will.

Guess you like

Origin blog.csdn.net/valsedefleurs/article/details/130399789