DEV Community

The NPM guide I would have loved as a beginner

Chandelier Axel on December 10, 2020

As a junior developer, I struggled a lot with NPM. Do you remember copy/pasting all the npm commands without knowing what they do ? Or the first ti...
Collapse
 
josuerodriguez98 profile image
Josué Rodríguez (He/Him)

Kudos! Nice article! Let me tell you a little story about when I started using node: I didn't know about the --save flag and I just installed everything with npm install . When I tried running the project on a friend's computer everything (as expected) crashed. After this, I remember putting into the README this:
"To run this project, please run these commands

  • npm install packageA
  • npm install packageB
  • npm install packageZ" 😂😂😂
Collapse
 
mendoza profile image
David Mendoza (He/Him)

gif

Collapse
 
chandelieraxel profile image
Chandelier Axel

Good thing this is now the default behavior !

Collapse
 
jessedebruijne profile image
Jesse de Bruijne

Nice article! I was a bit confused with the phrase:

Please don't do the same mistake as I did, and prevent committing this folder to your repository !

Because it can also be read as: "The mistake I made was not committing this folder". Maybe you could rephrase it a little. Other than that, very useful article!

Collapse
 
ionutarhire profile image
Arhire Ionut

I think you made a mistake when giving the examples with '~' and '^'. 4.18.1 should switch places with 4.17.9

Collapse
 
chandelieraxel profile image
Chandelier Axel

Indeed ! Such a big mistake, thanks for pointing out. It has been fixed now. <3

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

If you ever use npm init -y, you should also know there is npm config set.

Collapse
 
brombaut profile image
Ben Rombaut

Good article. I remember one of the first questions I had when dealing with npm was whether the package-lock.json file was suppose to be committed to the origin repo, or whether it should be ignored like the node_modules directory.

Collapse
 
paras594 profile image
Paras 🧙‍♂️

This was quite useful !! :)

Collapse
 
zakariaelk profile image
Zakaria Elk

Very useful! Thank you!!

Collapse
 
ash_bergs profile image
Ash

Wonderful read, I loved how you covered the shorthand commands. Thanks for writing!

Collapse
 
kullboii profile image
Aadi Manchekar

Thank you!

Collapse
 
swedlong profile image
Alexander Chan

Really nice article!