Hướng dẫn cài đặt nodejs Informational, Commercial

Copyright OpenJS Foundation and Node.js contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation, please see our Trademark Policy and Trademark List. Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

The OpenJS Foundation | Trademark Policy | Privacy Policy | Code of Conduct | Security Reporting

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.



Alpine Linux

Node.js LTS and npm packages are available in the Main Repository.

apk add nodejs npm

Node.js Current can be installed from the Community Repository.

apk add nodejs-current

Android

Android support is still experimental in Node.js, so precompiled binaries are not yet provided by Node.js developers.

However, there are some third-party solutions. For example, Termux community provides terminal emulator and Linux environment for Android, as well as own package manager and extensive collection of many precompiled applications. This command in Termux app will install the last available Node.js version:

pkg install nodejs

Currently, Termux Node.js binaries are linked against

pacman -S nodejs npm

7 (depending on

pacman -S nodejs npm

8 package).

Arch Linux

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

pacman -S nodejs npm

CentOS, Fedora and Red Hat Enterprise Linux

Node.js is available as a module called

pacman -S nodejs npm

9 in CentOS/RHEL 8 and Fedora.

dnf module install nodejs:

where

dnf module install nodejs:

0 corresponds to the major version of Node.js. To see a list of available streams:

dnf module list nodejs

For example, to install Node.js 18:

dnf module install nodejs:18/common

Alternatives

These resources provide packages compatible with CentOS, Fedora, and RHEL.

  • maintained and supported at https://github.com/nodejs/snap
  • maintained and supported by NodeSource

Debian and Ubuntu based Linux distributions

Node.js binary distributions are available from NodeSource.

Alternatives

Packages compatible with Debian and Ubuntu based Linux distributions are available via .

fnm

Fast and simple Node.js version manager built in Rust used to manage multiple released Node.js versions. It allows you to perform operations like install, uninstall, switch Node versions automatically based on the current directory, etc. To install fnm, use this .

fnm has cross-platform support (macOS, Windows, Linux) & all popular shells (Bash, Zsh, Fish, PowerShell, Windows Command Line Prompt). fnm is built with speed in mind and compatibility support for

dnf module install nodejs:

1 and

dnf module install nodejs:

2 files.

FreeBSD

The most recent release of Node.js is available via the www/node port.

Install a binary package via pkg:

pkg install node

Or compile it on your own using ports:

cd /usr/ports/www/node && make install

Gentoo

Node.js is available in the portage tree.

emerge nodejs

IBM i

LTS versions of Node.js are available from IBM, and are available via the 'yum' package manager. The package name is

pacman -S nodejs npm

9 followed by the major version number (for instance,

dnf module install nodejs:

4,

dnf module install nodejs:

5 etc)

To install Node.js 14.x from the command line, run the following as a user with *ALLOBJ special authority:

apk add nodejs-current

0

Node.js can also be installed with the IBM i Access Client Solutions product. See this support document for more details

macOS

Download the directly from the nodejs.org web site.

If you want to download the package with bash:

apk add nodejs-current

1

Alternatives

Using Homebrew:

apk add nodejs-current

2

Using MacPorts:

apk add nodejs-current

3

Using pkgsrc:

Install the binary package:

apk add nodejs-current

4

Or build manually from pkgsrc:

apk add nodejs-current

5

n

dnf module install nodejs:

6 is a simple to use Node.js version manager for Mac and Linux. Specify the target version to install using a rich syntax, or select from a menu of previously downloaded versions. The versions are installed system-wide or user-wide, and for more targeted use you can run a version directly from the cached downloads.

See the homepage for install methods (bootstrap, npm, Homebrew, third-party), and all the usage details.

If you already have

dnf module install nodejs:

7 then installing

dnf module install nodejs:

6 and then the newest LTS

dnf module install nodejs:

9 version is as simple as:

apk add nodejs-current

6

NetBSD

Node.js is available in the pkgsrc tree:

apk add nodejs-current

7

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

apk add nodejs-current

4

Nodenv

dnf module list nodejs

0 is a lightweight node version manager, similar to

dnf module list nodejs

1. It's simple and predictable. A rich plugin ecosystem lets you tailor it to suit your needs. Use

dnf module list nodejs

0 to pick a Node version for your application and guarantee that your development environment matches production.

Nodenv installation instructions are maintained . Please visit that page to ensure you're following the latest version of the installation steps.

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 .

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

apk add nodejs-current

9

After this you can use

dnf module list nodejs

1 to switch between released versions and versions built from source. For example, if the version of Node.js is v8.0.0-pre:

pkg install nodejs

0

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

pkg install nodejs

1

nvs

Windows

The

dnf module list nodejs

4 version manager is cross-platform and can be used on Windows, macOS, and Unix-like systems

To install

dnf module list nodejs

4 on Windows go to the release page here and download the MSI installer file of the latest release.

You can also use

dnf module list nodejs

6 to install it:

pkg install nodejs

2

macOS,UnixLike

You can find the documentation regarding the installation steps of

dnf module list nodejs

4 in macOS/Unix-like systems

Usage

After this you can use

dnf module list nodejs

4 to switch between different versions of node.

To add the latest version of node:

pkg install nodejs

3

Or to add the latest LTS version of node:

pkg install nodejs

4

Then run the

dnf module list nodejs

9 command to add a version of node to your

dnf module install nodejs:18/common

0 for the current shell:

pkg install nodejs

5

To add it to

dnf module install nodejs:18/common

0 permanently, use

dnf module install nodejs:18/common

2:

pkg install nodejs

6

OpenBSD

Node.js is available through the ports system.

pkg install nodejs

7

Using pkg_add on OpenBSD:

pkg install nodejs

8

openSUSE and SLE

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

  • openSUSE Leap 15.2:

    dnf module install nodejs:18/common

    3,

    dnf module install nodejs:

    4,

    dnf module install nodejs:

    5
  • openSUSE Tumbleweed:

    dnf module install nodejs:18/common

    6
  • SUSE Linux Enterprise Server (SLES) 12:

    dnf module install nodejs:18/common

    3,

    dnf module install nodejs:

    4, and

    dnf module install nodejs:

    5 (The "Web and Scripting Module" must be .)
  • SUSE Linux Enterprise Server (SLES) 15 SP2:

    dnf module install nodejs:18/common

    3,

    dnf module install nodejs:

    4, and

    dnf module install nodejs:

    5 (The "Web and Scripting Module" must be .)

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

pkg install nodejs

9

Different major versions of Node can be installed and used concurrently.

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:

apk add nodejs-current

4

Or build manually from pkgsrc:

apk add nodejs-current

5

Snap

Node.js snaps are available as

dnf module install nodejs:

9 on the Snap store.

Solus

Solus provides Node.js in its main repository.

pacman -S nodejs npm

2

Void Linux

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

pacman -S nodejs npm

3

Windows

Download the directly from the nodejs.org web site.

Alternatives

Using Winget:

pacman -S nodejs npm

4

After running one of the two commands above, it may be necessary to restart the terminal emulator before the

dnf module install nodejs:

9 CLI command becomes available.

Using Chocolatey:

pacman -S nodejs npm

5

Using Scoop:

pacman -S nodejs npm

6

z/OS

IBM® SDK for Node.js - z/OS® is available in two installation formats, SMP/E and PAX. Select the installation format that applies to you: