In the world of software engineering understanding how to use a package manager like npm is a basic skill. Using a package manager effectively is fundamental to the engineering side of building modern software applications.
If you have a candidate that does not know what npm is and is going in for a JavaScript job, they are probably not ready to be working as a professional software engineer.
As a recruiter, this is a good topic to learn about just from a candidate evaluation standpoint.
You probably know what git and Github are used for, right? I wrote about it previously here. Well if not, here is a quick recap. Git is a version control system used to store source code, and record changes to it over time. Like the history of a word document.
What is source code? It is the raw text files that comprise the instructions of a program. When you write source code it is just text files and it might look like this:
const printme = "World";
console.log("Hello");
for (let i = 0; i < 3; i++) {
console.log(printme);
}
That is an example of JavaScript source code that when is run displays on the console. The console is just an area where debug messages show up in the browser (you could open it by pressing f12).
You can see this running on codepen here.
This is just source code. You could share the code directly with somebody but it might be difficult for somebody else to consume it into their own program easily.
This is where package managers come in.
When your source code is ready to be released and shared with other people (as a part of another program) then you publish a release to a package manager.
Before you are ready to publish you might need to compile or transform the code in some way (and also you should really test it well).
To make a loose analogy working on source code is kind of like drafting up a design for a new toaster, while sending it to the factory to be made and produced is kind of publishing that source code to a package manager.
To be totally clear: when you are working on a product like a web application you are probably not going to publish it to a package manager. You only publish libraries of code to package managers that will be consumed by other programs.
npm (yes it is always written lowercase) is the package manager for JavaScript and Node.js. That means you are also going to use npm when you are working with React, Angular, TypeScript, or Vue (for example).
So how is it used? Well say for example you were writing a React application and you wanted to use this fancy tooltip library, because you wanted to easily add tooltips to your website.
FYI if you don't know what a tooltip is, here is an example I screencapped from my job description keyword tool:
To install it, you would just write
npm install react-tooltip
And the library would be installed in your project! Easy as that and you can now add tooltips to your website with very little work.
Again, you use npm to install libraries of code to your project. It is not really used to publish websites or products.
Package managers are not version control. They are for sharing libraries of finished code that can be consumed in other projects.
Every major programming language has at least one package manager that people use to share libraries. Many languages have several.
This is a fundamental way that people build open source software and modern web applications. If you find a candidate that does not know the package manager for their chosen programming language that is a huge red flag. How are they actually building working software?
On the flip side a really good signal of a strong developer is somebody who has published open source libraries to a package manager. I proudly display my npm packages that I author on my resume, for example.