Sharing is caring!

n – Interactively Manage Your Node.js Versions

Join the chat at npm npm npm npm

Node.js version management: no subshells, no profile setup, no convoluted API, just simple.

Want to install Node nightly releases? Try this!

(Unfortunately n is not supported on Windows yet. If you’re able to make it work, send in a pull request!)


Since you probably already have node, the easiest way to install n is through npm:

$ npm install -g n

Alternatively, you can clone this repo and

$ make install

to install n to bin/n of the directory specified in the environment variable $PREFIX, which defaults to /usr/local (note that you will likely need to use sudo). To install n in a custom location (such as $CUSTOM_LOCATION/bin/n), run PREFIX=$CUSTOM_LOCATION make install.

Once installed, n installs node versions to subdirectory n/versions of the directory specified in environment variable N_PREFIX, which defaults to /usr/local; the active node/iojs version is installed directly in N_PREFIX. To change the default to, say, $HOME, prefix later calls to n with N_PREFIX=$HOME or add export N_PREFIX=$HOME to your shell initialization file.

Additionally, consider third-party installer n-install, which allows installation directly from GitHub; for instance,

curl -L | bash

sets both PREFIX and N_PREFIX to $HOME/n, installs n to $HOME/n/bin, modifies the initialization files of supported shells to export N_PREFIX and add $HOME/n/bin to the PATH, and installs the latest stable node version.

As a result, both n itself and all node versions it manages are hosted inside a single, optionally configurable directory, which you can later remove with the included n-uninstall script. n-update updates n itself to the latest version. See the n-install repo for more details.

Installing/Activating Versions

Simply execute n <version> to install a version of node. If <version> has already been installed (via n), n will activate that version.

$ n 0.8.14
$ n 0.8.17
$ n 0.9.6

Execute n on its own to view your currently installed versions. Use the up and down arrow keys to navigate and press enter to select. Use q or ^C (control + C) to exit the selection screen. If you like vim key bindings during the selection of node versions, you can use j and k to navigate up or down without using arrows.

$ n

ο 0.8.17

Use or install the latest official release:

$ n latest

Use or install the latest LTS official release:

$ n lts

Subscribe to the Newsletter

Get our latest news,tutorials,guides,tips & deals delivered to your inbox.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.