DEV Community

NPM explain to me like I am five

Fulton Browne on October 23, 2019

What is NPM exactly? I know how to use it, but what does it do?

Collapse
 
dansilcox profile image
Dan Silcox • Edited

You want to build a cool spaceship out of Lego - someone else already made a rocket engine, a fuel tank, some grid fins and a launch tower - so you use NPM to find and get the premade components to build your space ship faster. Then, when you launch you realise that because nobody verified that the components were secure, someone hid a stow away on your spaceship 😂

Collapse
 
eaich profile image
Eddie

You want to build a cool spaceship out of Legos, so you use NPM to add a wing that was already made with Legos, but that wing is dependent on crayons, plastic, pasta, exhaust pipes, care bears, coffee, and metal shards and now your Lego spaceship is too heavy and bulky to take off.

Collapse
 
dansilcox profile image
Dan Silcox

Haha this sounds like my kids’ Lego!

Collapse
 
fultonbrowne profile image
Fulton Browne

That sounds a lot like a past gradle nightmare.

Collapse
 
fultonbrowne profile image
Fulton Browne

Great analogy, that defiantly helped understand npm better.

Collapse
 
tomekbuszewski profile image
Tomasz Buszewski

When you want to build something today, you use pre-made components, like Lego blocks. NPM is a Lego box with all the sizes, shapes and colors you can ask for, and then some. Just make sure you read the manual first because there are some Duplo ones that don't match!

On a more serious note, NPM is a package manager and repository. People publish there ready to use fragments of code – "packages" – written in JavaScript that are free to use. The standard for the JS community. Just remember to use the packages that are maintained (check via GitHub). You don't want unreliable vendors :)

Collapse
 
fultonbrowne profile image
Fulton Browne

Thanks for the tips.

Collapse
 
jarodpeachey profile image
Jarod Peachey

You're drawing a house on a piece of paper. You want to add doors and windows. You grab a stamp with windows and doors, and you use that in your drawing. Now you have a house (that you drew) with doors and windows (that someone else made, but you used)

Collapse
 
melroysblog profile image
Melroy's Blog • Edited

Package manager
More info: docs.npmjs.com/cli/npm

Usage: npm install

Collapse
 
devpato profile image
Pato

you just remind me to an interview that i had a while ago. same question but instead of npm it was ruby on rails lol