DEV Community

Lyumo
Lyumo

Posted on

1

Multiple Node.js versions - setup memo

While a lot of times, installing the latest version of Node.js via preferred package manager is enough, in some cases more flexibility is needed.
For example, sometimes there are several projects to work on, each of which relies on a specific Node.js version.

This blog post presents an overview of Node.js setup to support the above scenario.

There are two commonly used tools for managing multiple Node.js versions - nvm and n.
In this post, we will use nvm.

Using nvm (Node Version Manager)

nvm, or Node Version Manager, is a solution provided by Node.js team themselves. It is an open source with straightforward installation and usage flow.

Install with the package manager of your choice. For macOS, I will use Homebrew:

brew install nvm
Enter fullscreen mode Exit fullscreen mode

Next, let's check available Node.js versions:

nvm ls-remote
Enter fullscreen mode Exit fullscreen mode

Let's install the first version:

nvm install <version>  # Replace <version> with the desired version, e.g., 18.16.0
Enter fullscreen mode Exit fullscreen mode

Installed versions could be checked with:

nvm ls
Enter fullscreen mode Exit fullscreen mode

To switch between versions:

nvm use <version> # Replace <version> with the desired version
Enter fullscreen mode Exit fullscreen mode

With that, the setup of multiple Node.js versions has been completed.

It is also possible to set the version as default one with nvm alias default <version>.
See this answer for more details.
Finally, check the version with node --version command.

Resources

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay