Protractor Tutorial 6 – Introduction & Installation of NPM – Node Package Manager

Hello Folks,

In last post, we have seen about Introduction & Installation of NodeJS. In this post we will see about Introduction & Installation of NPM.

You must have heard of Maven and Maven Central Repository. Maven is a build automation tool for Java projects. A major use of Maven to install/download Java libraries dynamically on which your project depends. You can relate the same with NPM. Major difference between these two is that Maven is for Java libraries while NPM is for JavaScript and NodeJS libraries.

NPM stands for Node Package Manager which can be used to install, share and manage NodeJS and JavaScript libraries. In fact we can do more with NPM. Like Maven Central Repository we have NPM website to discover packages. NPM provides a Command Line Interface (CLI) to interact with it. This CLI can be used to install, uninstall, update or manage packages.

Installation of NPM:-

NPM comes with NodeJS. So when you install NodeJS in your system, NPM is also getting installed automatically. Installation of NodeJS we have seen already. Let’s check if NPM is also installed.

Run below command in terminal:-

npm -v or npm –version

We can also check where(directory) npm is installed. If you are using windows use “where npm”. If you are using linux or mac use “which npm” command to check installation directory of npm. You can see npm is inside nodejs.

NPM is a separate project from Node.js. It means we will have different versions of NPM and NodeJS. NPM tends to update more frequently. So if you want to update NPM run below command in terminal:-

npm install npm@latest -g

You can see earlier I had installed NPM version as 6.4.1 which is now 6.9.0.

Run npm -help to see usage of npm. We will see some more basic concepts of npm in upcoming posts.

More on Protractor in upcoming posts. Stay tuned and keep learning with me.


Leave a Reply

Your email address will not be published. Required fields are marked *