Language: EN

como-instalar-node-nodejs

How to install Node.js

Let’s see how to install Node.js on your computer. Which, I can already tell you, couldn’t be easier 😉.

In addition to the methods we will see, there are a few more. There’s something for everyone! You have all the necessary documentation on the official page Node.js — Download.

Installation of Node.js

Installation on Windows

We go to the official Node.js site and download the Node.js installer for Windows, under ‘Prebuilt Installer”.

nodejs-prebuilt-installer

Once downloaded, we run the installer. Follow the instructions of the installation wizard and accept the terms of the license agreement.

node-js-install-wizard

You just have to follow the instructions of the wizard. Literally, next next next… you can’t go wrong. Done! You now have Node.js installed on your system.

Installation on Linux (Ubuntu)

On Ubuntu and other Debian-based distributions, you can install Node.js and NPM from the apt package manager. Let’s make sure everything is installed.

sudo apt update
sudo apt upgrade

Now, we need to add the NodeSource repository, which provides updated versions of Node.js. To do this, we first need to install curl if you haven’t already:

sudo apt install curl

Now, we use curl to download the installation script from the NodeSource repository:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -

Note: The 20.x in the URL refers to the version of Node.js that we are installing. You can change it to the version you prefer.

Finally, we install Node.js with the following command:

sudo apt install -y nodejs

Installation on MacOS

If you have Homebrew installed, you can easily install Node.js with:

brew install node

Verify the installation

In any case or operating system, the first thing you need to do after installing Node.js is to verify the tool. It almost always works, but… just in case.

To verify that Node.js has been installed correctly, open the command line (CMD) and type,

node -v

It will return something like this, indicating the installed version.

v20.9.0

This should display the installed version of Node.js. To verify NPM, we type:

npm -v