📱

Managing multiple node version.

November 30, 2022

nvm stands for Node Version Manager and is a tool used to switch between different versions of Node.js. It's a great way to ensure that you are always running the latest version of Node.js, or to switch between different versions of Node.js for different projects.

Installation

To install nvm, you can use the following command:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

Usage

To use nvm, you can use the following command:

nvm install <version>

For example, to install the latest version of Node.js, you can use the following command:

nvm install node

To install a specific version of Node.js, you can use the following command:

nvm install 14.17.6

To use a specific version of Node.js, you can use the following command:

nvm use 14.17.6

To use the latest version of Node.js, you can use the following command:

nvm use node

To list all the versions of Node.js installed, you can use the following command:

nvm list

Using .nvmrc files is a great way to make sure that everyone on a team is running the same version of Node.js. A .nvmrc file is a simple text file that contains the version of Node.js that you want to use. When someone runs nvm in the same directory as the .nvmrc file, they will automatically switch to that version of Node.js.

Here's an example of a .nvmrc file that specifies the version of Node.js to use:

v10.16.3

To switch to the specified version of Node.js, all you have to do is run the following command inside the project directory that contains the .nvmrc file:

nvm use

And that's it! 🤩 Using nvm and .nvmrc files is a great way to ensure that everyone on a team is using the same version of Node.js. 🎉

🤖This post was was written in part by GPT-3.

Edit this page on github .