Node.js

mac | Install NVM with different versions of node

Install NVM on to mac

Open up a new Terminal and run the following to install nvm:

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

First, you can get the list of available versions by list-remote or ls-remote ‘

nvm list-remote # or nvm ls-remote

You can install a specific version by nvm with install subcommand.

nvm install <version> # like: 18.18.2

If you want to install the LTS version you can use --lts instead of version number.

nvm install --lts

Or you can install the latest version with node instead of version number.

nvm install node

Load a specific version of Node.js

Now you install some versions of Node.js on your machine; So you can see the list of installed versions with list or ls subcommand.

nvm list # or nvm ls

If you want to load a specific version, use use subcommand. With this subcommand, you can load Node.js by version number or --lts flag.

nvm use <version>

Uninstall a Node.js version

Finally, If you want to uninstall a version of Node.js, you can use uninstall subcommand for that.

First, you need to switch to another version with use then you can uninstall that.

nvm uninstall <version>

Leave a Reply

Your email address will not be published. Required fields are marked *