Downloading and Extracting nvm
Begin by downloading the Node Version Manager (nvm) package from the official GitHub repository at: https://github.com/coreybutler/nvm-windows/releases
After downloading the package, extract its contents to your desired location on your system.
Installation Process
During installation, you'll need to specify two important paths:
- The installation directory for nvm itself
- The location where different Node.js versions will be stored
Setting Up Node.js
Before installing Node.js versions, configure the download mirrors to ensure faster and more reliable downloads.
Configuring Node.js Download Mirror
Set up a mirror for Node.js downloads using the following command (the default is https://nodejs.org/dist/):
nvm node_mirror https://npmmirror.com/mirrors/node/
Configuring npm Download Mirror
Similarly, configure a mirror for npm packages (default is https://github.com/npm/npm/archive/):
nvm npm_mirror https://npmmirror.com/mirrors/npm/
Available Node Versions
To view all available Node.js versions that can be installed:
nvm list available
Installing a Specific Version
Install a particular version of Node.js (example below shows version 14.15.0):
nvm install 14.15.0
Switching Between Versions
Switch to a specific Node.js version using:
nvm use 14.15.0
Note: If you encounter errors (exit status 1), ensure that the installation path doesn't contain Chinese characters or spaces. Also, make sure to run Command Prompt as an administrator.
Verifying Node.js Installation
Check the currently installed Node.js version:
node -v
Verifying npm Installation
Check the npm version:
npm -v
Configuring npm Registry
For faster package downloads in China, configure npm to use the Taobao registry (default is https://registry.npmjs.org/):
npm config set registry https://registry.npmmirror.com
Verifying npm Registry
Confirm the current npm registry setting:
npm config get registry
Additional nvm Commands
Listing Installed Versions
Display all Node.js versions currently installed on your system:
nvm ls
Alternatively, you can use:
nvm list
Or:
nvm list installed
Installing Latest Version
To install the latest available Node.js version:
nvm install latest
Switching to Specific Version
Switch to a particular Node.js version:
nvm use @14.15.0
Checking Current Version
View the currently active Node.js version:
nvm current
Creating Version Aliases
Assign a custom name to a specific Node.js version:
nvm alias stable 14.15.0
Removing Aliases
Delete a previously created alias:
nvm unalias stable
Reinstalling npm Packages
Reinstall global npm packages for a specific Node.js version:
nvm reinstall-packages 14.15.0
Enabling/Disabling nvm
Enable Node.js version management:
nvm on
Disable Node.js version management:
nvm off
Checking Proxy Settings
View current proxy configuration:
nvm proxy
Managing Mirrors
Set or view the Node.js mirror URL:
nvm node_mirror [url]
Set or view the npm mirror URL:
nvm npm_mirror [url]
Uninstalling Versions
Remove a specific Node.js version from your system:
nvm uninstall 14.15.0
Switching Architecture
Switch between Node.js versions and system architectures (32-bit/64-bit):
nvm use 14.15.0 64
Setting Root Directory
Configure or view the root directory for nvm:
nvm root [path]