You can customize the install source, directory, profile, and version using the NVM_SOURCE, NVM_DIR, PROFILE, and NODE_VERSION variables.Įg: curl. nvm.sh -no-use) to postpone using nvm until you manually use it. You can add -no-use to the end of the above script (. If the environment variable $XDG_CONFIG_HOME is present, it will place the nvm files there. " $NVM_DIR/nvm.sh " # This loads nvm Additional Notes Nvm allows you to quickly install and use different versions of node via the command line.Įxport NVM_DIR= " $([ -z " $/nvm " ) "
In this guide, I have gone through how to install and manage several versions of Node.js on the same machine using the node version manager. Simply run the node use command within the root of your project folder. To change the version of Node.js at a project level. For example, to use version 14.0.1 you can run the following command. To select a specific version of Node.js that you want to use you can run the following command nvm use. Choose the version of Node.js you want to use If you run the nvm ls command now, you will get a list of the installed Node.js versions. We can install another Node.js version, for example, version 14.1.0 which was listed above using the following command. Note: In addition, the node version manager will install the corresponding npm version for the Node.js being installed. To install the latest version of Node.js you can run the following command. The latest installer for the nvm-windows can be found on the coreybutler GitHub account here. Also make sure to delete Node.js installation related files on this location “C:\Program Files\nodejs”.
Note: If you happen to have Node.js installed on your machine, uninstall it now to avoid conflicts and confusion. I have chosen to use nvm-windows because it has good backing from Microsoft and Google.
Advantages of using a node version manager With a node version manager, you can install and switch between multiple versions of Node.js based on the needs of the different projects you are working on. Installing Node.js via this method allows you to only have a single installed version of Node.js at a time on your machine.īut what do you do if you are working on several projects where each project requires a different version of Node.js to run smoothly?
The default and most common way of installing Node.js on a Windows PC is via a Node.js installer. If you are a front-end developer chances are high that you have worked with Node.js in one way or the other.
It is widely used for both front-end and back-end software development.
Node.js is a popular, open-source, cross-platform JavaScript run time environment. This post is a step-by-step guide on the recommended method of installing Node.js on a Windows PC using a Node Version Manager, popularly known as nvm. Photo by Caspar Camille Rubin on Unsplash