[node] Precautions for the use of nvs

[node] Precautions for the use of nvs

Original address

In use nvsbefore have been using nvm windowsthis tool, with the also very cool, not long ago to see science text, so would like to try, then tried in windowsa rollover, so here record it. First look at the popular science article: use nvs to manage the local Node.js version


Recommended cmd manual installation steps

git bash environment configuration

# ~/.bashrc  
#  $ProgramData   $LOCALAPPDATA
. $NVS_HOME/nvs.sh

nvsCommand not found in git bash

nvs v1.5.1Use MSIor choco install nvsafter installation can be used normally, but will be missing nvs.shif you are git bashunder use nvswill not find the command, subsequent versions will fix the problem. The recommended cmd manual installation procedure does not have this problem.

nvsAnd the npmcommand does not take effect

After installation, in a new terminal window nvsand npmwhen it does not take effect, please log out and log in again, or restart the system once.

Note: Especially nvs linkafter the first use , the nodesum npmwill not take effect. It is best to log out and log in again.

Shared npmglobal module

First of all, it is not recommended that you share global modules across versions unless you know what you are doing.

Popular science article: Use nvs to manage the local Node.js version Here is how to set it up.

#  git bash 
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
# .bashrc 
#  ~/.npm-global/   ~/.npm-global/bin
# windows 10 bin 
echo "export PATH=~/.npm-global/:$PATH" >> ~/.bashrc

source ~/.bashrc

Note: ( nvs v1.5.1)

  1. Pay attention to check whether the configuration path of the global module is correct (pit)

cmdAnd power shelladd global module environment variables under

Through the above configuration git bash, the global installed npmnormal work of the module, but in cmdor power shellwill find not find the command, tried to add a system variable , but still does not take effect, put a final issues, the official gave the solution .

setx PATH "%PATH%;%USERPROFILE%\.npm-global"

After setting: cmder, cmd, powershell, cygwinall in force


  1. nvs useIs to change shellthe nodeversion of the current window , not the global environment (the difference between nvm)
  2. nvs linkIs the nodeversion that changes the global environment


Popular Science: Use nvs to manage the local Node.js version

Migrate from nvm to nvs

cmder using .bashrc

VS Code Support-Node Version Switcher

xizhibei Node Version Manager

Windows: when use npm prefix share global modules fails


ss64 setx