What is the NVM

Node.js Version Manager (NVM) is a command line application that helps you quickly update, install, use, and uninstall the local global Node.js version, similar to RVM for managing Ruby.

N or NVM can run only in MAC or Linux, and NVM-Windows or NVMW can run only in Win.

NVM provides powerful and concise commands:

  • nvm arch [32|64]: displays whether Node.js is running on a 32-bit or 64-bit architecture. Setting 32/64 overrides the default system architecture.
  • nvm install [arch]: Installs a specific version. Version you can specify the node.js version number or latest to indicate the latest stable version. (Optional) Specify whether to install the 32-bit or 64-bit version (default system architecture). will[arch]Set toallTo install 32-bit and 64-bit versions.
  • nvm list [available]: Lists all installed versions of Node.js. typeavailableA list of all versions currently available for download is displayed at the end.
  • nvm on: Enables node.js version management.
  • nvm off: Disables Node.js version management (no installed versions are uninstalled).
  • nvm proxy [url]: Sets the agent used for the download. will[url]Leave blank to view the current agent. will[url]Set to “None” to remove the agent.
  • nvm uninstall: Uninstalls a specific version.
  • nvm use [arch]: Switches to the specified version. Optionally, specify a 32/64-bit architecture.nvm useThe selected version will continue to be used, but switch to 32/64-bit mode based on the values provided. For information about using “use” (or using “.nvmrc “) in a specific directory, seeissue #16.
  • nvm root: Specifies a root directory to store different versions of Node.js. If no value is set to, the currently set directory is displayed.
  • nvm version: Displays the current version of NVM-Windows.
  • nvm node_mirror: Sets the node image source. Please use it for Chinese usersNpm.taobao.org/mirrors/nod…
  • nvm npm_mirror: Sets the NPM image source. Please use it for Chinese usersNpm.taobao.org/mirrors/npm…

Why use NVM

  • Production environments need to use stable LTS versions, and existing projects need to use different Node.js versions
  • Learning environments require the latest version to try out different new Node.js features

NVM – Windows installation

If node. js already exists on the host, uninstall it first.

  • Visit github.com/coreybutler… Click on the latest version of nVM-setup. zip to download it locally and install it

  • If you choose to install the portable version instead of MSI, download NVM -noinstall.zip, unzip it to any folder, and run install. CMD. Also don’t forget to add NVM_HOME(the NVM installation directory) and NVM_SYMLINK(the desired NodeJS installation directory) to the environment variables and add %NVM_HOME% to path; %NVM_SYMLINK%

Test Installation successful

Win+R Enter CMD or use win10 terminal to open the command line and enter NVM to test whether the installation is successful.

Changing the Download Source

Method a

Go to the NVM installation directory, edit setting.txt, and add two lines of code:

node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
Copy the code

Method 2

You can also use the command line interface to enter

nvm node_mirror https://npm.taobao.org/mirrors/node/
nvm npm_mirror https://npm.taobao.org/mirrors/npm/
Copy the code

Use NVM to manage versions

nvm install latest Install the latest version of Node.js
nvm use 14.3.0 Use a specific version
nvm list List all currently installed versions
nvm uninstall 14.2.0 Uninstall a specific version
Copy the code

Install and use the specified version

Lists all versions and unloads the specified version


I’m a front-end engineer, and if you like what I share or blog, please check out my gold digger account Gylidian, or my personal blog gylidian.js.org, we’re gay.