N Kaushik

Introduction to Node.js version management library n

February 13, 2022

How to use n to handle node versions:

n is a Node.js version management library. It is simple to use and it makes easier to switch between Node.js versions quickly.

In this post, I will show you how to install it and how to use it with different examples.


n library is used to manage Node.js versions. You can install any Node.js version on your system, switch between current installed version quickly, etc.

Where it is supported:

n works on linux, macOS and windows subsystem for linux including other unix like systems. It doesn’t work in native shell for windows, Git for windows bash or with Cygwin DLL.

How to install n:

You can install n using npm. If npm is installed on your system, you can use the below command to install it:

npm install -g n


npm i -g n

You can clone the repo and use make install to install it.

On mac, it is available to install from HomeBrew and MacPorts.

brew install n


port install n

Also, n-install allows to install it directly from Github on MacOS and Linux:

curl -L https://git.io/n-install | bash

How to install a Node.js version using n:

n caches Node.js versions in subdirectory n/versions. By default, you will find it in /usr/local/n/versions. This makes the reinstall fast. The active version is installed in bin, include, lib and share.

Install a specific version:

Use n to install a specific version of Node.js. For examole,

n 14.15

You might need to use sudo:

sudo n 14.15

Or, you can use n to check the downloaded versions and switch between the versions using the arrow keys.

n version browsers

Numeric versions:

Specify the complete version name or the primary version name:

n v14.15.5
n 14.15
n 14 // for 14.x.y 
n 14.1 // for 14.1.x


You can use labels to install specific versions:

n lts // newest lts release
n latest // newest official release
n current // newest official release

or for named release streams:

n argon
n boron
n carbon
n nightly
n test/x.y.z
n rc/5

Remove version:

Remove cached versions:

n 14.15 14.15.1

Remove all cached versions except the install one:

n prune

Remove the installed Node.js

n uninstall

Check downloaded Node.js path:

Run the below command to check the downloaded Node.js path:

n which 13.1

You can use any downloaded version to run a js file:

n run 14.15 --debug example.js

Other commands:


n --help

Show all downloaded versions:

n ls

Show diagnostics to solve issues:

n doctor

Subscribe to my Newsletter