Installing Node.js via package manager

Note: The packages on this page are maintained and supported by their respective packagers, not the Node.js core team. Please report any issues you encounter to the package maintainer. If it turns out your issue is a bug in Node.js itself, the maintainer will report the issue upstream.



Arch Linux

Node.js and npm packages are available in the Community Repository.

pacman -S nodejs npm

Debian and Ubuntu based Linux distributions

Also including: Linux Mint, Linux Mint Debian Edition (LMDE), elementaryOS, bash on Windows and others.

Node.js is available from the NodeSource Debian and Ubuntu binary distributions repository (formerly Chris Lea's Launchpad PPA). Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 6.x on older distros.

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Alternatively, for Node.js 8:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Optional: install build tools

To compile and install native addons from npm you may also need to install build tools:

sudo apt-get install -y build-essential

Available architectures:

Supported Ubuntu versions:

Supported Debian versions:

A Node.js package is also available in the official repo for Debian Sid (unstable), Jessie (testing) and Wheezy (wheezy-backports) as "nodejs". It only installs a nodejs binary.

The nodejs-legacy package installs a node symlink that is needed by many modules to build and run correctly. The Node.js modules available in the distribution official repositories do not need it.

Supported Linux Mint versions:

Supported elementary OS versions:

Supported Trisquel versions:

Supported BOSS versions:

Enterprise Linux and Fedora

Including Red Hat® Enterprise Linux® / RHEL, CentOS and Fedora.

Node.js is available from the NodeSource Enterprise Linux and Fedora binary distributions repository. Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.

Note that the Node.js packages for EL 5 (RHEL5 and CentOS 5) depend on the EPEL repository being available. The setup script will check and provide instructions if it is not installed.

On RHEL, CentOS or Fedora, for Node.js v6 LTS:

curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -

Alternatively for Node.js 8:

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

Then install:

sudo yum -y install nodejs

Optional: install build tools

To compile and install native addons from npm you may also need to install build tools:

sudo yum install gcc-c++ make
# or: sudo yum groupinstall 'Development Tools'

Available architectures:

Supported Red Hat® Enterprise Linux® versions:

Supported CentOS versions:

Supported CloudLinux versions:

Supported Fedora versions:

Other distributions known to be supported:

Alternatives

Official Fedora Node.js and npm packages are available in Fedora 18 and later. Install with:

sudo dnf install nodejs

In a hurry for the latest updates? Grab them from updates-testing.

Enterprise Linux (RHEL and CentOS) users may use the Node.js and npm packages from the EPEL repository.

Install the appropriate epel-release RPM for your version (found on the EPEL repository homepage), then run:

sudo yum install nodejs npm --enablerepo=epel

In a hurry for the latest updates? Grab them from epel-testing.

Available architectures:

Supported Red Hat® Enterprise Linux® versions:

RHEL 6 is no longer supported through EPEL, you can however use Red Hat Software Collections.

Additionally, versions of CentOS and Scientific Linux corresponding to the above RHEL versions are also officially supported by all EPEL packages, including nodejs. Amazon Linux is not officially supported by EPEL due to significant incompatibilities previously reported to the epel-devel mailing list, however you might find that nodejs at least still works.

Supported Fedora versions:

FreeBSD and OpenBSD

Node.js is available through the ports system.

FreeBSD:

/usr/ports/www/node

OpenBSD:

/usr/ports/lang/node

Development versions are also available using ports on FreeBSD

cd /usr/ports/www/node-devel/ && make install clean

Or packages on FreeBSD:

pkg_add -r node-devel

Using pkg-ng on FreeBSD

pkg install node

Or the development versions:

pkg install node-devel

Using pkg_add on OpenBSD

pkg_add node

Gentoo

Node.js is available in the portage tree.

emerge nodejs

NetBSD

Node.js is available in the pkgsrc tree:

cd /usr/pkgsrc/lang/nodejs && make install

Or install a binary package (if available for your platform) using pkgin:

pkgin -y install nodejs

nvm

Node Version Manager is a bash script used to manage multiple released Node.js versions. It allows you to perform operations like install, uninstall, switch version, etc. To install nvm, use this install script.

On Unix / OS X systems Node.js built from source can be installed using nvm by installing into the location that nvm expects:

$ env VERSION=`python tools/getnodeversion.py` make install DESTDIR=`nvm_version_path v$VERSION` PREFIX=""

After this you can use nvm to switch between released versions and versions built from source. For example, if the version of Node.js is v8.0.0-pre:

$ nvm use 8

Once the official release is out you will want to uninstall the version built from source:

$ nvm uninstall 8

openSUSE and SLE

Node.js is available in the main repositories under the following packages:

1: The "Web and Scripting Module" must be added before installing.

For example, to install Node.js 4.x on openSUSE Leap 42.2, run the following as root:

zypper install nodejs4

macOS

Simply download the Macintosh Installer direct from the nodejs.org web site.

If you want to download the package with bash:

curl "https://nodejs.org/dist/latest/node-${VERSION:-$(wget -qO- https://nodejs.org/dist/latest/ | sed -nE 's|.*>node-(.*)\.pkg</a>.*|\1|p')}.pkg" > "$HOME/Downloads/node-latest.pkg" && sudo installer -store -pkg "$HOME/Downloads/node-latest.pkg" -target "/"

Alternatives

Using Homebrew:

brew install node

Using MacPorts:

port install nodejs<major version>

# Example
port install nodejs7

Using pkgsrc:

Install the binary package:

pkgin -y install nodejs

Or build manually from pkgsrc:

cd pkgsrc/lang/nodejs && bmake install

SmartOS and illumos

SmartOS images come with pkgsrc pre-installed. On other illumos distributions, first install pkgsrc, then you may install the binary package as normal:

pkgin -y install nodejs

Or build manually from pkgsrc:

cd pkgsrc/lang/nodejs && bmake install

Void Linux

Void Linux ships node.js stable in the main repository.

xbps-install -Sy nodejs

Windows

Simply download the Windows Installer directly from the nodejs.org web site.

Alternatives

Using Chocolatey:

cinst nodejs
# or for full install with npm
cinst nodejs.install

Using Scoop:

scoop install nodejs
Scroll to top