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.
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 system-icu (depending on libicu 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 nodejs in CentOS/RHEL 8 and Fedora.
dnf module install nodejs:stream>
where 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.
- Node.js snaps maintained and supported at https://github.com/nodejs/snap
- Node.js binary distributions maintained and supported by NodeSource
Debian and Ubuntu based Linux distributions
Alternatives
Packages compatible with Debian and Ubuntu based Linux distributions are available via Node.js snaps.
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 install script.
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 .node-version and .nvmrc 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 nodejs followed by the major version number (for instance, nodejs12 , nodejs14 etc)
To install Node.js 14.x from the command line, run the following as a user with *ALLOBJ special authority:
yum install nodejs14
Node.js can also be installed with the IBM i Access Client Solutions product. See this support document for more details
macOS
Download the macOS Installer directly 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.*|\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 nodejsmajor 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
n
n 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 npm then installing n and then the newest LTS node version is as simple as:
npm install -g n n lts
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
Nodenv
nodenv is a lightweight node version manager, similar to nvm . It’s simple and predictable. A rich plugin ecosystem lets you tailor it to suit your needs. Use nodenv to pick a Node version for your application and guarantee that your development environment matches production.
Nodenv installation instructions are maintained on its Github page. 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 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
nvs
Windows
The nvs version manager is cross-platform and can be used on Windows, macOS, and Unix-like systems
To install nvs on Windows go to the release page here and download the MSI installer file of the latest release.
You can also use chocolatey to install it:
choco install nvs
macOS,UnixLike
You can find the documentation regarding the installation steps of nvs in macOS/Unix-like systems here
Usage
After this you can use nvs to switch between different versions of node.
To add the latest version of node:
nvs add latest
Or to add the latest LTS version of node:
nvs add lts
Then run the nvs use command to add a version of node to your PATH for the current shell:
$ nvs use lts PATH -= %LOCALAPPDATA%\nvs\default PATH += %LOCALAPPDATA%\nvs\node\14.17.0\x64
To add it to PATH permanently, use nvs link :
nvs link lts
OpenBSD
Node.js is available through the ports system.
/usr/ports/lang/node
Using pkg_add on OpenBSD:
pkg_add node
openSUSE and SLE
Node.js is available in the main repositories under the following packages:
- openSUSE Leap 15.2: nodejs10 , nodejs12 , nodejs14
- openSUSE Tumbleweed: nodejs16
- SUSE Linux Enterprise Server (SLES) 12: nodejs10 , nodejs12 , and nodejs14 (The «Web and Scripting Module» must be enabled.)
- SUSE Linux Enterprise Server (SLES) 15 SP2: nodejs10 , nodejs12 , and nodejs14 (The «Web and Scripting Module» must be enabled.)
For example, to install Node.js 14.x on openSUSE Leap 15.2, run the following as root:
zypper install nodejs14
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:
pkgin -y install nodejs
Or build manually from pkgsrc:
cd pkgsrc/lang/nodejs && bmake install
Snap
Node.js snaps are available as node on the Snap store.
Solus
Solus provides Node.js in its main repository.
sudo eopkg install nodejs
Void Linux
Void Linux ships Node.js stable in the main repository.
xbps-install -Sy nodejs
Windows
Download the Windows Installer directly from the nodejs.org web site.
Alternatives
Using Winget:
winget install OpenJS.NodeJS # or for LTS winget install OpenJS.NodeJS.LTS
After running one of the two commands above, it may be necessary to restart the terminal emulator before the node CLI command becomes available.
Using Chocolatey:
cinst nodejs # or for full install with npm cinst nodejs.install
Using Scoop:
scoop install nodejs # or for LTS scoop install nodejs-lts
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:
- Installing and configuring SMP/E edition of Node.js on z/OS
- Installing and configuring PAX edition of Node.js on z/OS
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.
Installing Node.js® and NPM on Windows
Node.js® is a JavaScript-based environment which you can use to create web-servers and networked applications. You can also use it to perform helpful tasks on your computer such as concatenating and minifying JavaScript files and compiling Sass files into CSS.
NPM is a “package manager” that makes installing Node “packages” fast and easy. A package is just a code library that extends Node by adding useful features. For example, the “request” package simplifies the process of making HTTP requests so you can easily get web resources from other sites.
NPM is installed when you install Node.js®
Prerequisites
- You should have some familiarity with an application that lets you issue command line instructions. For example, the Windows Command Prompt, PowerShell, Cygwin, or the Git shell (which you get when you install Github for Windows).
Installation Overview
Installing Node.js® and NPM is pretty straightforward using the installer package available from the Node.js web site.
Installation Steps
- Download the Windows installer from Nodejs.org.
- Run the installer (the .msi file you downloaded in the previous step.)
- Follow the prompts in the installer (Accept the license agreement, click the NEXT button a bunch of times and accept the default installation settings).

- Restart your computer. You won’t be able to run Node.js until you restart your computer.
Test it!
Make sure you have Node and NPM installed by running simple commands to see what version of each is installed:
- Test Node. To see if Node is installed, open the Windows Command Prompt, Powershell or a similar command line tool, and type node -v . This should print the version number so you’ll see something like this v0.10.35 .
- Test NPM. To see if NPM is installed, type npm -v in Terminal. This should print the version number so you’ll see something like this 1.4.28
- Create a test file and run it. A simple way to test that node.js works is to create a simple JavaScript file: name it hello.js, and just add the code console.log(‘Node is installed!’); . To run the code simply open your command line program, navigate to the folder where you save the file and type node hello.js . This will start Node.js and run the code in the hello.js file. You should see the output Node is installed! .

How to Update Node and NPM
New versions of Node and NPM come out frequently. To install the updates, just download the installer from the Nodejs.org site and run it again. The new version of Node.js and NPM will replace the older versions.
How to Uninstall Node and NPM
You uninstall Node.js and NPM the same as you would most all Windows software:
- Open the Windows Control Panel
- Choose the Programs and Features option
- Click the “Uninstall a program”
- Select Node.js, and click the Uninstall link.
# Installing Node.js and discord.js
open in new window . discord.js v14 requires Node v16.11.0 or higher.
To check if you already have Node installed on your machine (e.g., if you’re using a VPS), run node -v in your terminal. If it outputs v16.11.0 or higher, then you’re good to go! Otherwise, continue reading.
On Windows, it’s as simple as installing any other program. Download the latest version from the Node.js website
open in new window , open the downloaded file, and follow the steps from the installer.
On macOS, either:
-
Download the latest version from the Node.js website
On Linux, you can consult this page
open in new window to determine how you should install Node.
# Preparing the essentials
To use discord.js, you’ll need to install it via npm (Node’s package manager). npm comes with every Node installation, so you don’t have to worry about installing that. However, before you install anything, you should set up a new project folder.
Navigate to a suitable place on your machine and create a new folder named discord-bot (or whatever you want). Next you’ll need to open your terminal.
# Opening the terminal
open in new window , you can press Ctrl + ` (backtick) to open its integrated terminal.
On Windows, either:
- Shift + Right-click inside your project directory and choose the «Open command window here» option
- Press Win + R and run cmd.exe , and then cd into your project directory
On macOS, either:
- Open Launchpad or Spotlight and search for «Terminal»
- In your «Applications» folder, under «Utilities», open the Terminal app
On Linux, you can quickly open the terminal with Ctrl + Alt + T .
With the terminal open, run the node -v command to make sure you’ve successfully installed Node.js. If it outputs v16.11.0 or higher, great!
# Initiating a project folder
npm init
How to Install Node.js and npm on Windows, macOS, and Linux

Node.js came as a blessing for JavaScript developers worldwide struggling with swapping among multiple languages and frameworks to amplify their code into a sustainable development environment. With Node.js, you can finally build web applications with two-way connections where both the server-side and client-side can thoroughly communicate in real-time and exchange data. Indeed, Node.js has been revolutionary for developers who wanted to push real-time web applications over WebSocket. If you’re aiming forward to enhancing your web development skills to the next level and becoming a full-stack JavaScript developer, Node.js indeed prepares the path towards that enthusiastic buzzword! In this article, we’ll demonstrate a step-by-step guideline for installing Node.js on your computer and commencing with your web development journey.
What Is Node.js?
The first thing you should know is that Node.js is not a programming language! You may already be aware of this fact, but it bears repeating for new developers in the field who may mistake Node.js for a unique programming language. It’s not! Node.js is an open-source runtime environment for the JavaScript language that reshapes JavaScript’s characteristics and upgrades its functionality. As a result, you can use JavaScript for frontend and backend development, enabling full-stack development solely using JavaScript. Initially, Node.js was designed to serve real-time performance, pushed-back architectures. But since then, Node.js has grown into a vital element for server-side programming for event-driven, non-blocking servers. Most conventional websites and API services today depend on Node.js. Before Node.js, if you wanted to store any data on the database or connect your program to the database, you needed support from a server-side language. That’s because JavaScript couldn’t regulate the backend process. Consequently, you had to learn server-side languages like PHP, Python, Ruby, or C# — or seek a backend developer’s help. The Node.js environment empowers JavaScript to directly employ the database and function properly as a backend language. As a result, you can ultimately build and run a program using only JavaScript with Node.js. Node.js uses the V8 JavaScript runtime engine as its root power, and it employs a non-blocking I/O architecture that’s event-driven. All these together construct Node.js and help drive products towards robust performance.
Who Uses Node.js?
- NASA
- Netflix
- PayPal
- Trello
- eBay
- Walmart
- Mozilla
- Medium
If you study these companies, you may notice that they run their businesses on different services or products. But they all have a critical factor in common: they rely on Node.js. Indeed, using Node.js can solve most of your development issues, never mind what industry you’re in.
Advantages of Using Node.js
Choosing the right programming platform for your tech stack is as important as the labor you want to invest in. Multiple factors should be considered when you look for the advantages of using a particular platform. Things like the learning curve, development speed, community, and scale can alter the overall balance of benefits.
Here are the main advantages of using Node.js:
- Simple syntax
- Easy learning curve
- Ability to scale quickly
- Open source and flexible
- Cross-platform development
- Single-language full-stack development
- Real-time communication
- Vast and active community
Node.js Prerequisites
Before installing Node.js, you need to ensure that you’ve gathered all the necessary bits of knowledge and downloaded all required installation files and elements.
Firstly, it would help if you had a basic understanding of JavaScript and its syntax — this will make picking up Node.js easier for you.
Secondly, a basic understanding of an object-oriented programming (OOP) language will help you work on server-side coding.
Lastly, rather than rushing into deep learning, take it one step at a time. Always remember that you’re not a day late or a dollar short as long as you’re progressing.
System Requirements
Node.js doesn’t require a fancy hardware setup to run; most computers of this era should handle Node.js efficiently. Even the most miniature computers like BeagleBone or Arduino YÚN can run Node.js.
Nevertheless, much still depends on what other memory hog software you’ve got running on the same system. But in most cases, you shouldn’t be worried unless your computer is from the Mesozoic Era!
LTS Version vs Current Version
Node.js offers two different versions for you to download: the LTS version and the Current version.
The first one is Long-Term Support (LTS), which indicates the version that has been in the market for a while and comes with all mandatory support. Consequently, you can access a bunch of information and community for additional help with this version.
This LTS version is recommended to most users because of its sustainability and 18-month-long support cycle. As it’s a stable version, using it to produce backends can help you achieve a robust outcome.
The Current version indicates the latest released version of Node with the most recently added and updated features. But this version has less support behind it (around eight months) and possible bug exposure. Therefore, experts suggest using this version only for frontend development.
Considering all these factors, if you’re a regular user who loves to live hassle-free, go for the LTS version. On the other hand, if you’re an advanced user who loves the adventure of experiencing new technology, you can choose to install the Current version.
How to Install Node.js and npm
Every operating system has a distinct method of installing Node.js. The core setup file differs for each OS to OS. However, the Node.js creators have taken care to provide you with the files needed for each system.
In the next portion of the article, we’ll discuss installing Node.js on Windows, macOS, and Linux operating systems.
How to Install Node.js on Windows?
Follow this step-by-step guide to install Node.js on Windows.
1. Download Windows Installer
First, you need to download the Windows Installer (.msi) file from the official Node.js website. This MSI installer database carries a collection of installer files essential to install, update, or modify the existing Node.js version.
Notably, the installer also carries the Node.js package manager (npm) within it. It means you don’t need to install the npm separately.
When downloading, select the correct version as per your operating system. For example, if you’re using a 64-bit operating system, download the 64-bit version, and if you’re using the 32-bit version, download the 32-bit version:

2. Begin the Installation Process
Once you open and run the .msi file, the installation process begins. But you have to set a few parameters before running the installation process.
Double-click on the installer file and run it. The installer will ask you to accept the Node.js license agreement. To move forward, check the “I accept” box and click Next:

Then, select the destination where you want to install Node.js. If you don’t want to change the directory, go with the Windows default location and click the Next button again.

The next screen will show you custom setup options. If you want a standard installation with the Node.js default features, click the Next button. Otherwise, you can select your specific elements from the icons in the tree before clicking Next:

Node.js offers you options to install tools for native modules. If you’re interested in these, click the checkbox to mark your preferences, or click Next to move forward with the default:

3. Run Node.js Installation on Windows
Lastly — and this is the easiest part of all — click the Install button to begin the installation process:

The system will complete the installation within a few seconds or minutes and show you a success message. Click on the Finish button to close the Node.js installer.

4. Verify Node.js Installation
So the installation process is completed. Now, you have to check whether Node.js is successfully installed or not.
To verify the installation and confirm whether the correct version was installed, open your PC’s command prompt and enter the following command:
Node --version
And to check the npm version, run this command:
npm --version

If the Node.js version and npm are correctly installed, you’ll see the version name in the CMD prompt.
How To Install Node.js on macOS?
Follow these step-by-step guidelines to install Node.js on macOS.
macOS installer (.pkg) file from the Node.js website. There’s only a 64-bit version, so you don’t have to worry about which to download.

2. Begin Node.js Installation on macOS
Check your Download folder for the installer file and click on it to start the installation process.
The Node.js installer carries the Node.js core file, and, consequently, the installation process installs both Node.js and npm from the installer file. Therefore, you don’t need to install npm separately.
Then, click Continue to move forward with the installation.

You must agree to the terms of usage to install Node.js. Read through it before clicking the Agree button to continue if you’d like to explore the license agreement.

At this screen, you need to select the installation location. Usually, the OS determines a default installation location. If you have other requirements, you can change the location. Otherwise, keep the default location.
3. Run Node.js Installation on macOS
Until now, you’ve set all the preferences that are needed to install Node.js on macOS fully. Now click on the Install button to finish things up.

After a successful installation process, the system will show you a confirmation message. As npm is integrated within the Node.js installer, the notification should indicate proof of npm installation too.
Finally, click on the Close button to close the dialogue box.

4. Verify Node.js Installation on macOS
You’ve now successfully installed Node.js on your macOS. However, you should check to confirm that the installation process was successful and whether the Node.js and npm versions are working properly on your macOS.
To check the Node.js version, you need to open your macOS terminal, click the Command + Space keys, or search the terminal from the search bar.

To check the Node.js version, type:
Node --version
And to check the npm version, run this command:
npm --version

If the Node.js and npm versions are visible, both of them are correctly installed and working fine. If not, you may need to recheck to find the error or try the installation process again.
How To Install Node.js on Linux?
The Linux operating system works a bit differently than the other traditional operating systems. That’s because Linux is open-source, offering you more freedom, customization, and advanced functionalities.
If you’re casual with commands, you should feel comfortable with Linux. Here, we are about to discuss the easiest method of installing Node.js on the Linux operating system.
1. Choose the Node.js Version for Your Linux Distribution
The Linux operating system has hundreds of different distributions because of the diversity it provides. And users love to customize and harness different versions’ specific functionalities using distinct distributions.
Firstly, find the installation instruction for your specific distribution from Node.js’s Binary Distributions page. For this guide, we’ll be using Ubuntu for illustration purposes.

2. Install the Curl Command-Line Tool
Before going for Node.js installation, ensure that you have the curl command-line utility installed on your system. If not, then paste this command on your terminal to install curl:
sudo apt install curl
It may ask for your system password to verify the permission of the installation. Once you input the password, the system should begin the curl installation.

3. Start Node.js Installation
You need to copy and paste the Node.js installation command into your terminal (in our case, we can grab it from the Ubuntu distribution page) so that the system can begin the Node.js installation.
Info
Every Node.js version has a different installation command. Install whichever version of Node.js matches your Linux setup.
For instance, here, we’ll be installing Node.js v14.x. These are the installation commands for Ubuntu:
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
As you already have the curl command line installed on your terminal, you’ll need to copy and paste the first command (the curl command) on your terminal and run it.

The curl command begins the Node.js installation process, updates your system, and downloads all Node.js libraries required to install Node.js on your Linux OS.

Now, all the libraries and resources of Node.js have been downloaded to your PC. With one final command, we can finish installing Node.js and npm on your computer.
Copy and paste the second line of command from the installation instructions above into your Linux terminal:
sudo apt-get install -y nodejs

If you’ve done everything correctly, Node.js will install correctly on your Linux distribution. Now input the Clear command to clear the terminal.
4. Verify Node.js Installation on Linux Ubuntu distribution
As you’ve installed Node.js, you can verify to check whether the installation is successful or not. To confirm the installation, you need to run two simple Linux commands on your Linux terminal.
To check the Node.js version, type:
Node --version
And to check the npm version, type:
npm --version

If the Node.js version and npm are installed correctly, you’ll see the Node.js and npm version names visible on the Linux terminal. It indicates that you have successfully installed Node.js and npm on your Linux distribution.
Check and Update npm Version
As we’ve mentioned, npm is the Node.js package manager. It manages the dependencies for packages. Without npm, you would have to unpack all your Node.js packages manually every time you want to upload a framework. But npm relieves you of this responsibility and takes care of it automatically.
Regularly updating npm also updates your local packages and improves the code used in your projects. However, as npm automatically installs with the Node.js version you choose, it often misses the latest npm release. In such cases, you can check your npm version and update it manually in a simple process.
The processes to check and update your npm version are very similar between Windows, macOS, and Linux — you’ll be running the same command on each.
Update npm in Windows
To check the npm version, run the following command:
npm -v
npm --version
And to update the npm version, run this command:
npm install -g npm@latest
After running this command on your CMD prompt on Windows, the system will update your npm version and install the additional packages in a few seconds. In the end, you can recheck the version to confirm the update of the npm version.

Update npm on macOS
To check the npm version on macOS, open your terminal and run the following command:
npm -v
npm --version

To update the npm version, run this command in your macOS terminal:
npm install -g npm@latest

Update npm in Linux
To update your npm version on Linux, type these commands into your terminal:
sudo npm install -g n
sudo n latest

With Node.js, you can take your web dev skills to the next level . so what are you waiting for? Get started with this guide Click to Tweet
Summary
Node.js has become a popular programming environment quickly because of its usefulness in both frontend and backend. Thousands of active users have created a vast community that helps keep new developers and their questions from slipping through the cracks.
In essence, it’s easy to start with Node.js because of its simplicity, and its capabilities for creating advanced applications are extraordinary. It can also help turn you into a full-stack developer in a short time. These features make Node.js an inevitable choice for next-generation programming.
Have we missed any helpful tips about installing Node.js on Windows, macOS, or Linux? Let us know in the comments section!
Get all your applications, databases, and WordPress sites online and under one roof. Our feature-packed, high-performance cloud platform includes:
- Easy setup and management in the MyKinsta dashboard
- 24/7 expert support
- The best Google Cloud Platform hardware and network, powered by Kubernetes for maximum scalability
- An enterprise-level Cloudflare integration for speed and security
- Global audience reach with up to 35 data centers and 260 PoPs worldwide
Get started with a free trial of our Application Hosting or Database Hosting. Explore our plans or talk to sales to find your best fit.
