How To Install Nodejs And NPM On Windows, Linux and Mac OS

Nodejs, npm, Javascript Logo dark background

JavaScript is really popular language for building web based frontend application, even before the presences of Nodejs. Now there's Nodejs, with it not only you can just build front end application, now you can build any kind of application using Javascript with Node Js. With it's package manager called NPM (node package manager), the biggest collections of libraries in programming world, you will build a robust application using Nodejs with its huge collections of libraries written in Javascript, you can just search whatever dependency you need, pick it, use it whichever for free.

Now if you are a beginner programmer who do not know how to get started doing Javascript programming with package manager. This is without further ado let's just start on how to install Nodejs into your platform.

1. Install Nodejs

You need to install Nodejs to use NPM, to have Nodejs installed on your Windows computer. You can download Nodejs installer from nodejs.org, click on the installer and just follow the default configuration.

If you are using Linux or MacOS, you don't need to download zip archive of Nodejs because usually for most Linux distributions already have Nodejs on their repositories. Using Linux especially for Ubuntu, just open a terminal and type in:

sudo apt-get install nodejs

For Mac Os, using brew instead:

brew install node

Just wait for the process to finish.

2. Add npm to path

After the installation process of Nodejs is finished, if you try typing npm on terminal or cmd, you will get an error telling you that npm is not in your path. You need to put npm to your path by following the below instructions.

a. For Windows
- On windows, by default npm will be installed under C:\Program Files\nodejs\
- Press windows button, search for edit system environment, open that program.
- Environment variables > system variables > edit Path > New, and then add C:\Program Files\nodejs\ > OK and Apply
- Then close the cmd and reopen it, now if you type npm, it is not valid command but at least now you have npm on your path. You've successfully installed nodejs.

b. Linux/Ubuntu/Mac OS users
To add NPM on your Ubuntu machine, simply by using apt package manager:

sudo apt-get install npm

If you are using Linux but not Ubuntu, I am so sorry because I've never used Linux other than Ubuntu, basically just replacing apt-get with  yum if you are using Fedora for example.

For Mac OS you don't have to install, npm is already included with Nodejs.

So that's how simple it is to install Nodejs for you to begin your Journey developing application using Javascript. If you already have Nodejs and NPM on your terminal, you can do a simple test for example to test Nodejs, just type node and then follow by your Javascript example code:

node
console.log("Hello World!");


In the future you will use NPM as package manager, to add, remove, upgrade your Javascript dependencies. The syntax you need to remember that you will be using it frequently is for example installing and removing dependencies, the syntax is as follows:

npm install the-dependency-name
npm uninstall the-dependency-name

Comments

Popular posts from this blog

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

ASUS Battery Health Charging Software To Make Your Battery Life Longer

How To Uninstall Angular CLI, The Angular Framework

Is Nox Player a Malware? Nox Android Emulator

JavaFX Combo Box with Search Autocomplete