Featured image of post NVM install node.js on Windows 10

NVM install node.js on Windows 10

How to use NVM to manage your node.js version on Windows 10

It’s very convenient to develop node.js applications on Mac by using NVM to manage our node.js version. But if your want to develop node.js application on Windows, you still can use NVM to manage your node.js version. Then we can switch node.js version anytime on any project.

Environment

Windows 10 x64 node.js 14.17.5

Install Windows version of NVM, nvm-windows

Goto Github coreybutler/nvm-windows Repository to download nvm-setup.zip file, and install it step by step.

I’m using Windows PowerShell to access NPM command. You have to close the entire Windows PowerShell, not just tab, to get the NVM environment setting after install nvm-setup.zip finished.

If you want to let VS Code terminal to get the NVM environment, then you have to restart your computer. It is not working when I just restart the VS Code.

NVM on Windows 10

List the available Node.js version

nvm list available

The Windows Node.js version list command in NVM is different from Mac. It’s using nvm list available command instead of using nvm ls-remote

PS C:\Users\KJ> nvm list available

|   CURRENT    |     LTS      |  OLD STABLE  | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
|    16.7.0    |   14.17.5    |   0.12.18    |   0.11.16    |
|    16.6.2    |   14.17.4    |   0.12.17    |   0.11.15    |
|    16.6.1    |   14.17.3    |   0.12.16    |   0.11.14    |
|    16.6.0    |   14.17.2    |   0.12.15    |   0.11.13    |
|    16.5.0    |   14.17.1    |   0.12.14    |   0.11.12    |
|    16.4.1    |   14.16.1    |   0.12.12    |   0.11.10    |
|    16.4.0    |   14.16.0    |   0.12.11    |    0.11.9    |
|    16.3.0    |   14.15.5    |   0.12.10    |    0.11.8    |
|    16.2.0    |   14.15.4    |    0.12.9    |    0.11.7    |
|    16.1.0    |   14.15.3    |    0.12.8    |    0.11.6    |
|    16.0.0    |   14.15.2    |    0.12.7    |    0.11.5    |
|   15.14.0    |   14.15.1    |    0.12.6    |    0.11.4    |
|   15.13.0    |   14.15.0    |    0.12.5    |    0.11.3    |
|   15.12.0    |   12.22.5    |    0.12.4    |    0.11.2    |
|   15.11.0    |   12.22.4    |    0.12.3    |    0.11.1    |
|    15.9.0    |   12.22.2    |    0.12.1    |    0.9.12    |
|    15.8.0    |   12.22.1    |    0.12.0    |    0.9.11    |

This is a partial list. For a complete list, visit https://nodejs.org/download/release

If you can’t see the version that you want to install on the list, you can visit Node.js Release site to find the version that you want.

Install Node.js 14.17.5

nvm install

Install Node.js by just using the nvm install command will come out that Node.js version is only available in 32-bit Windows OS. The default version of NVM installations is the 32-bit version, but my Windows is 64-bit.

PS C:\Users\KJ> nvm install 14.17.5
nvm.0.0
Node.js vnvm.0.0 is only available in 32-bit.

If you want to change Node.js install version, then just simply add 64 behind the install command. Then you can specify the install version is changing to the 64-bit.

nvm install 14.17.5 64

PS C:\Users\KJ> nvm install  14.17.5 64
Downloading node.js version 14.17.5 (64-bit)...
Complete
Creating C:\Users\KJ\AppData\Roaming\nvm\temp

Downloading npm version 6.14.14... Complete
Installing npm v6.14.14...

Installation complete. If you want to use this version, type

nvm use 14.17.5

Specify Node.js version

nvm use 14.17.5

You can use nvm use command to specify the Node.js version, it will need admin permission to change Node.js version in processing.

NVM will add 2 variables, NVM_HOME and NVM_SYMLINK, in the OS environment variable behind the scenes. NVM will associate your Node.js version to the path of the NVM_SYMLINK when you run nvm use command. So it needs admin permission to change the association of the Node.js version.

Name Setting Description
NVM_HOME C:\Users\KJ\AppData\Roaming\nvm NVM install directory
NVM_SYMLINK C:\Program Files\nodejs NVM soft link directory

Now we can start using NVM to manage our Node.js version in Windows 10 !!

List all installed Node.js version

nvm list

PS C:\Users\KJ>nvm list

    16.7.0
  * 14.17.5 (Currently using 64-bit executable)

nvm command

nvm     
Running version 1.1.7.

Usage:

  nvm arch                     : Show if node is running in 32 or 64 bit mode.
  nvm install <version> [arch] : The version can be a node.js version or "latest" for the latest stable version.
                                 Optionally specify whether to install the 32 or 64 bit version (defaults to system arch).
                                 Set [arch] to "all" to install 32 AND 64 bit versions.
                                 Add --insecure to the end of this command to bypass SSL validation of the remote download server.
  nvm list [available]         : List the node.js installations. Type "available" at the end to see what can be installed. Aliased as ls.
  nvm on                       : Enable node.js version management.
  nvm off                      : Disable node.js version management.
  nvm proxy [url]              : Set a proxy to use for downloads. Leave [url] blank to see the current proxy.
                                 Set [url] to "none" to remove the proxy.
  nvm node_mirror [url]        : Set the node mirror. Defaults to https://nodejs.org/dist/. Leave [url] blank to use default url.
  nvm npm_mirror [url]         : Set the npm mirror. Defaults to https://github.com/npm/cli/archive/. Leave [url] blank to default url.
  nvm uninstall <version>      : The version must be a specific version.
  nvm use [version] [arch]     : Switch to use the specified version. Optionally specify 32/64bit architecture.
                                 nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode.
  nvm root [path]              : Set the directory where nvm should store different versions of node.js.
                                 If <path> is not set, the current root will be displayed.
  nvm version                  : Displays the current running version of nvm for Windows. Aliased as v.

Reference

Donate KJ 贊助作者喝咖啡

如果這篇文章對你有幫助的話,可以透過下面支付方式贊助作者喝咖啡,如果有什麼建議或想說的話可以贊助並留言給我
If this article has been helpful to you, you can support the author by treating them to a coffee through the payment options below. If you have any suggestions or comments, feel free to sponsor and leave a message for me!
方式 Method 贊助 Donate
PayPal https://paypal.me/kejyun
綠界 ECPay https://p.ecpay.com.tw/AC218F1
歐付寶 OPay https://payment.opay.tw/Broadcaster/Donate/BD2BD896029F2155041C8C8FAED3A6F8
All rights reserved,未經允許不得隨意轉載
Built with Hugo
Theme Stack designed by Jimmy