Back to Blog Home

What is npm

Carla Wells| Javascript | 6 months, 4 weeks



 

npm stands for Node Package Manager and is a software registry for javascript packages used mostly alongside node.js. npm consists of two main components :

 

  • An online database of free and paid javascript packages 

 

  • A command line tool for developers to interact with that online database

 

Using npm’s command line tool you can do three tasks:

 

  • Install and uninstall packages for your project 

 

  • Manage versions of different packages

 

  • Dependency management of packages 

 

npm is world’s largest collection of free and reusable code and currently hosts about 650,000 + packages. Anyone can publish a javascript pacakage on npm registry in CommonJS format.It manages about 3 billion + package downloads a week and counts 11 million + developers using it’s service. 

 

npm helps developers to manage dependencies for various javascript packages that they use in the project by defining them in package.json along with their semantic versions. Whenever all those dependencies need to be installed, user can simply do npm install from the root of the project. 

 

npm automatically gets installed when you install nodejs on your system.

Now downloading a package is very easy and straighfirward with npm

You just have to open terminal and run :

 

npm install ‘package name’

 

npm stores the downloaded packages in the folder ‘node_modules’ of your project

 

Then in your project you can simply use ‘require’ to use the package 

 

var p = require(‘package name’);

 

npm overtime has become ubiquitous with web development and is the de facto standard for building your javascript applications.

 

 



Join 1000+ People Who Subscribe to Weekly Blog Updates

Back to Blog Home