DEV Community

Cover image for N, manage easily your node versions
Gátomo
Gátomo

Posted on

N, manage easily your node versions

Before share a node JS tool you should consider these things:

  • Your tool has no bugs
  • Your tool has documentation
  • Your tool has compatibility between versions

Compatibility is something important to keep in mind. Developers needs different versions according to their needs, so your tool must have support for different versions.

The problem is...

The problem is that you need to install different versions for test it, and download and use the node installer for each version takes his time.
Afortunately there are a lot of tools for manage versions quickly. Today I'm going to talk about N, a simple node version manager.


What is N?

N is a really simple Node version manager. It helps you to change between versions with a command.
N supports Linux and MacOS, but not Windows, unless you use WSL.


Here starts a short tutorial

Ok, you know what is N and why you need it. Now let's go to install it and learn some commands.

Installation

Install N globally with your favorite package manager.

installing N
Now you can use N CLI with n

Install versions

Install a version with n <version>

installing node from N
You can also put latest or current instead of lts.
Once the version is installed, N will save in cache the version for be available offline at any moment. Similar to Yarn with node modules 🧵

View installed versions

If you installed many versions (e.g. 16.5.0 and 14.18.2) you can view a list of cached versions and select which to install.
You should see something like this
view and install
Use the arrow keys to change versions, and press enter for install.

Uninstall versions

If you want to clear some specifics versions or all the cache, you can use the rm and prune commands, respectively.

Uninstall

It really works?

Yes, it works without problems. You can do node --version and check it.


Congratulations 🥳! You have a useful tool for manage node versions. You can check all commands in the NPM page and view the source code in the GitHub repository 🦑

Are you going to use N? You prefer other version manager? Tell me in the comments whatever you want 😄

Top comments (0)