

To install the lts version of Node.js: curl -fsSL | bash -s lts If npm is not yet available, one way to bootstrap an install is to download and run n directly. Sudo chown -R $(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share # take ownership of Node.js install destination folders

Sudo mkdir -p /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share # make sure the required folders exist (safe to execute even if they already exist) To avoid requiring sudo for n and npm global installs, it is suggested you either install to your home directory using N_PREFIX, or take ownership of the system directories: # make cache folder (if missing) and take ownership The active Node.js version is installed in subdirectories bin, include, lib, and share. N caches Node.js versions in subdirectory n/versions. The n command downloads and installs to /usr/local by default, but you may override this location by defining N_PREFIX. If you already have Node.js installed, an easy way to install n is using npm: npm install -g n N does not work in native shells on Microsoft Windows (like PowerShell), or Git for Windows BASH, or with the Cygwin DLL. It is written as a BASH script but does not require you to use BASH as your command shell.

N is supported on macOS, Linux, including with Windows Subsystem for Linux, and various other unix-like systems. Using Downloaded Node.js Versions Without Reinstalling.n – Interactively Manage Your Node.js Versions.Node.js version management: no subshells, no profile setup, no convoluted API, just simple. N – Interactively Manage Your Node.js Versions
