Install NodeJS in Windows/Linux/macOS

NodeJS is a JavaScript runtime built on Chrome’s V8 JavaScript engine, according to their website, basically, you can run JavaScript code on server-side and use JavaScript as your backend language. So let’s see how to install NodeJs on your machine.

macOS

First go to the NodeJS download page, choose the LTS (stable) version, or latest version and then click on the macOS installer. This will download a .pkgfile. Once this is downloaded open and click on continue, accept the license agreement, and then finally install. Wait until the installation gets completed. Now it’s time to verify the installation.

Open up your terminal and type,

node -v

this should output the NodeJS version which is installed on your system, in my case it was 13.8.0. This is it, you’ve successfully installed NodeJS on your mac machine. You can check your npm version by running following on you terminal,

npm -v

Linux/Ubuntu

Installing NodeJS on Ubuntu is pretty straightforward and simple. All you need to do just type two commands on the terminal. Generally on windows, if you install nodeJS it comes with NPM also. But in Ubuntu you have to install NPM separately that’s why I said you gonna need two commands one for NodeJS and second for NPM. Okay, so enough details let’s hit the command.

To install NodeJS type following command in your terminal.

sudo apt install nodejs

Similarily to install npm type the following command.

sudo apt install npm

Once you are done executing both commands then verify its installation. To verify Nodejs and npm is installed type the following command in terminal.

node -v //to verify to nodejs
npm -v //to verify npm

These two commands will return their installed versions respectively. So this is how we install NodeJS on the Ubuntu machine.

Windows

Just like macOS, there’s an installer is available for windows as well. Go to this Link to download LTS (stable) version or this Link for the latest version. Click and download windows installer, this will download a .msi file.

Now open this file, select continue or next, accept terms, etc and install it. Wait till installation is finished. Now it’s time to verify the installation.

Open up your command prompt ( cmd ) and type following,

node -v

this should output your installed NodeJS version and run

npm -v

for checking npm version.