Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
Last active April 13, 2024 04:54
Show Gist options
  • Save bradtraversy/09177818de0f43a6e74e2cd05d1fe596 to your computer and use it in GitHub Desktop.
Save bradtraversy/09177818de0f43a6e74e2cd05d1fe596 to your computer and use it in GitHub Desktop.
NPM Crash Course Commands
# GET VERSION
npm -v (or --version)
# GET HELP
npm help
npm
# CREATE PACKAGE.JSON
npm init
npm init -y (or --yes)
# SET DEFAULTS
npm config set init-author-name "YOUR NAME"
npm set init-license "MIT"
# GET DEFAULTS
npm config get init-author-name
npm get init-license
# REMOVE DEFAULTS
npm config delete init-author-name
npm delete init-license
# INSTALLING LOCAL PACKAGES
npm install lodash --save (or npm install --save lodash)
npm install moment --save
npm install gulp gulp-sass --save-dev
# MOVE TO ANOTHER FOLDER
npm install
npm install --production
# REMOVING MODULES
npm uninstall gulp-sass --save-dev
npm remove gulp --save-dev
#INSTALL CERTAIN VERSIONS
npm install lodash@4.17.3 --save
# UPDATE
npm update lodash --save
# INSTALL GLOBAL MODULE
npm install -g nodemon
npm install -g live-server
# RUN NODEMON
nodemon
# FIND ROOT FOLDER
npm root -g
# REMOVE GLOBAL PACKAGES
npm remove -g nodemon
# LISTING PACKAGES
npm list
npm list --depth 0
npm list --depth 1
# INSTALL LIVE-SERVER LOCALLY
npm install live-server --save-dev
# NPM SCRIPT
"scripts": {
"start": "node index.js",
"dev": "live-server"
},
@KariNarhi
Copy link

Great guide. Though I think that # MOVE TO ANOTHER FOLDER on line 29 should be # INSTALL TO ANOTHER FOLDER, because the commands "npm install" or "npm install --production" do not move the user or the files to another directory.

@hamid814
Copy link

@erwindw thanks, fixed

Also guys, --save is not neede for NPM 5+

@hamid814
Copy link

the best tutorial ever,
thanks and hope U bests

@giovankoulits
Copy link

You rock Brad! Keep up the good work.

@HusainMansuri1
Copy link

Just Perfect!

@mike-4040
Copy link

Great list, thanks.

I've found shortcodes:
i for install
-D for --save-dev
are very convenient.

@Mubirupatrick2040
Copy link

Thanks Brad for the info, God bless you bro...

@Yoloko
Copy link

Yoloko commented May 23, 2020

thank you !

@edu1988
Copy link

edu1988 commented Jun 9, 2020

Thank you very much!

@irtiza-khan
Copy link

Thank You Brad your tutorials helps alot

@angyK-dev
Copy link

Thanks man! You just pushed me forward in that journey 😅

@m-mourouh
Copy link

thank you so much , very helpful

@Ujjawal0619
Copy link

Thanks Brad,
this is very helpful, also I would like to request you to update the list once please.

@Ksound22
Copy link

Ksound22 commented Jan 6, 2021

Old but gold

@mranand4
Copy link

Awesome !!!

@rfso
Copy link

rfso commented May 12, 2021

Thanks Brad. <3

@gihanadnivak
Copy link

noise 👍

@ankitkaushiks
Copy link

that was a great tutorial. Npm was complete Strange to me. Now it feels like a good friend.

@subarashii-huch09
Copy link

Thank you. 😊

@jdx-code
Copy link

Brad the saviour...

@ikennarichard
Copy link

Thank you Brad!

@Aryan-Srivastava
Copy link

Thanks a lot Brad !

@Maniche1981
Copy link

Thanks, Brad! much appreciated

@marcinsuski
Copy link

Thanks for this cheat sheet. Helps a lot!

@basitkorai
Copy link

I am in love with Brad❤

@Jaafar0941499966
Copy link

Thank you Brad!

@lombord
Copy link

lombord commented Sep 2, 2023

Love ya bro

@David-Sang96
Copy link

Thank you so much sir ❤❤❤❤

@JeanShipp
Copy link

JeanShipp commented Dec 12, 2023

Thanks for sharing it, I appreciate you sir. RatedWriting's GrabMyEssay review unfolds like a well-crafted narrative, offering a deep dive into the service's strengths and weaknesses visit this website for information. As a student seeking reliable evaluations, RatedWriting proves to be a dependable ally. The thorough examination of GrabMyEssay ensures that users embark on their academic assistance journey well-informed.

@Admo-dev
Copy link

Thanks so much for this. Really appreciate what you do sir.👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment