DEV Community

Cover image for Manage multiple Node.js versions
Alexandre Nédélec
Alexandre Nédélec

Posted on • Originally published at bordeauxcoders.com

1

Manage multiple Node.js versions

If you are working on various projects, you have likely encountered situations where you need to have multiple versions of Node.js installed on your computer.

You might not know it, but managing multiple Node.js versions is something you can do with pnpm, using the pnpm env command.

An example

pnpm env use -g lts 
Enter fullscreen mode Exit fullscreen mode

This example demonstrates how to install the LTS version of Node.js.

Additionally, you can install specific versions of Node.js, view the versions already present on your computer, or remove one.

Why use pnpm as your Node version manager?

Because managing your Node.js version is built into pnpm: if you already use pnpm as your npm package manager, you don't need to install another tool.

But there is absolutely nothing wrong with using another Node version manager if you prefer. I was using nvm-windows before and I was happy with it. I just don't see the point of installing it anymore as similar functionality is already available in pnpm.

Good to know

To specify a Node.js version to use in a project/folder, you can add an .npmrc file use-node-version setting, like that:

use-node-version=16.16.0
Enter fullscreen mode Exit fullscreen mode

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

👋 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