What is NPM? What does NPM DO?

As a matter of fact NPM stands for (Node Package Manager). NPM was created for developer to be able to share their JavaScript code. This way any developer can grab somebody else code that may solve his or her problems. This creates a great knowledge base of scripts that people can constantly update or improves and build. As a matter of fact, it is very rare that an app or website in these days is built from scratch. By using the collective intelligence we can grab the pieces of code that are really good and build on top of it to create our product.

Example

Using JavaScript can write virtual reality applications but you don’t have to figure out everything yourself. Someone out there already worked on being able to use JavaScript VR (Virtual Reality). So, you use that person’s code to start your project.

How Node Package Manager works

NPM has website with search bar and you can search packages. These packages located in the NPM registry and this registry keeps track of files that have been submitted. Anybody can submit new files to the NPM registry that we call packages or modules.

The packages that are located in the Node Package Manager registry contain two things. A JavaScript file and a package.json file.  The package.json is a Meta file that describes the packages.

NMP registry is just a registry of all the files JavaScript that other people have added to it. The idea is to have small JavaScript files that do one thing really well. So, that other people can use it. You can combine different pieces of code and different packages on your project to functionality. So, in this way you don’t have to rewrite something that already has been written by another person.

What does NPM DO?

Let say a person has written and JavaScript file that is very useful. So, they can add this file to the Node Package manger registry. So, other people can use it. You can search the files by using the search bar on NMP Official website.  People can download other people’s JavaScript files into their computer and start a project with them.

Benefits of Node Package Manger

You get expertise from others and maybe don’t know everything; maybe others are better than at certain things. You can use their collective knowledge to use their code.

There is also a down side of NPM registry. Remember not all packages are good code. Anybody can put their files to Node Package Manager and you also adding more bits to your project which makes your project size even bigger. So, if you are building a web app then you should minimize the size of your app to make a faster web app. There is an art to find good NPM packages. You will learn how to grab good packages from NPM when you have a Little bit experience.

READ MORE What is Ruby? Why you should Learn Ruby

What is Yarn NPM?

 So, let’s a little bit about the alternative of Yarn. Yarn is a tool to grab packages from NPM registry. Yarn and Node Package Manager are similar if you learn about yarn then you learns about it. When you want to find the packages for your project you will have two options to do this one is NPM and the second is Yarn. Yarn is one 100 percent similar to Node Package Manager but the fact is that it’s an alternative and it is managed by the Facebook.

Remember Facebook created Yarn and Microsoft own Node Package Mangager. The idea to build Yarn was that a couple of years ago people think that Node Package Manager is slower in a lot of operations. It did not include support for log files and not work fast enough.

Types of Packages in Node Package Manager

You can browse NPM to find the packages but there are three types of packages. These are described below:

  • The packages that you can use on the browser. This mean on the front end. You can download all that scripts that are useful for front-end. You can get the jQuery files.  
  • The second type of packages that it has is the back-end packages. The packages that you run on Node Js.

Muzammal Ahmad

I am an Ethical Hacker, Programmer, and SEO (Search Engine Optimization) expert. I love to write blogs and share knowledge with people. I also like to help people to solve their technical or internet relates problems.

Leave a Reply

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