How to Install Node.js
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Node.js can be installed and maintained multiple ways across the various platforms offered. Multiple releases of Node.js are available, along with multiple versions within the LTS branch. The decision about which of these versions to install can quickly become confusing, so this guide lists the main choices for installing Node.js on Linux, and some basic reasons why you may or may not want to use a certain method.
Linux Distro Repositories
Your distro’s repos likely contain an LTS release of Node.js. This is a good solution if:
You don’t need newer features.
You want the distro’s package manager to handle core updates.
You want to easily maintain uniformity among multiple Node.js servers.
NPM (Node Package Manager) is included with installations of Node.js by other methods. Here, however,
npm is a separate package from
nodejs and must be installed separately.
nodejs -$optioninstead of the standard
node -$option. One workaround is to install the package
nodejs-legacy, which maintains a symlink from
/usr/bin/nodejsso the normal
nodecommands can be used.
The NodeSource repository is a continuation and expansion of Chris Lea’s Node.js Ubuntu PPA to offer both
.rpm binaries for various Node.js release stages. This is the option mentioned on nodejs.org for those who would like to install using the operating system’s package manager. It generally provides more up-to-date packages than the distro’s repositories.
Node Version Manager
NVM is a separate project from Node.js and is one of the more common installation methods. NVM is installed using an installation script and its primary benefit is easy management of Node.js versions, including updating to newer releases and migrating your Node packages.
Official Binary Installer
Build from Source
Compiling from source code is the most advanced installation method, though it can be a remarkably simple process. Installing from source can add flexibility with compiling flags and ensures that you have the absolute latest codebase at the time of installation.
Node Package Manager (NPM)
A typical installation of Node.js includes the Node Package Manager (NPM). However, an exception is any Linux-distro-supplied version of Node.js which would need the package
npm installed. NPM is a package manager for Node.js packages in the NPM repository. You can find extensive NPM documentation at npmjs.com.
Making a Quick Decision (the TL;DR)
Still not sure which installation method to use? Then NVM is probably your best choice to start with. NVM facilitates easy installation and maintenance of Node.js and NPM, presents no naming issues with other software, and easily manages multiple installations of Node.js that can test your application before you push a Node.js update into your production environment.
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This page was originally published on