Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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"
},
@erwindw

This comment has been minimized.

Copy link

@erwindw erwindw commented Nov 15, 2017

Good tutorial, appreciated. Very minor detail. #INSTALL NODMON LOCALLY should be # INSTALL LIVE-SERVER LOCALLY

@bradtraversy

This comment has been minimized.

Copy link
Owner Author

@bradtraversy bradtraversy commented Jan 25, 2018

@erwindw thanks, fixed

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

@luisSanchezCruz

This comment has been minimized.

Copy link

@luisSanchezCruz luisSanchezCruz commented May 13, 2018

thanks u r the best !!!

@Zed-M

This comment has been minimized.

Copy link

@Zed-M Zed-M commented Aug 4, 2018

Thanks

@Rickylart

This comment has been minimized.

Copy link

@Rickylart Rickylart commented Aug 9, 2018

I am new to NPM and your crash course for it gave me pretty much what i wanna know about NPM.
Thanks

@RickJP

This comment has been minimized.

Copy link

@RickJP RickJP commented Nov 4, 2018

Awesome. That's a good guide!

@RobelTekle74

This comment has been minimized.

Copy link

@RobelTekle74 RobelTekle74 commented Dec 8, 2018

This is awesome. I am new to npm and I wanted to know how to create the gitignore file and how to put the modules in it.

@golamrabbiazad

This comment has been minimized.

Copy link

@golamrabbiazad golamrabbiazad commented Dec 27, 2018

Lovely, Cleared about NPM concept. Bunch of Thanks ☺️

@lagupa

This comment has been minimized.

Copy link

@lagupa lagupa commented Jan 16, 2019

You are a real concept artist teacher... please accept my kind boast in you but you very good teacher Brad. This days if I am learning something new in web dev I will youtube topic traversy media. You deserve the credit of hard bro!

@rodrigofmp

This comment has been minimized.

Copy link

@rodrigofmp rodrigofmp commented Apr 1, 2019

Great! Thank you.

@Suyash-Purwar

This comment has been minimized.

Copy link

@Suyash-Purwar Suyash-Purwar commented May 4, 2019

I really appreciate your work Brad. Thanks for this cheatsheet

@Metzo00

This comment has been minimized.

Copy link

@Metzo00 Metzo00 commented May 26, 2019

thank you Brad. You are awesome man!

@KariNarhi

This comment has been minimized.

Copy link

@KariNarhi KariNarhi commented Jul 9, 2019

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

This comment has been minimized.

Copy link

@hamid814 hamid814 commented Jul 17, 2019

@erwindw thanks, fixed

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

@hamid814

This comment has been minimized.

Copy link

@hamid814 hamid814 commented Jul 17, 2019

the best tutorial ever,
thanks and hope U bests

@chupacambra

This comment has been minimized.

Copy link

@chupacambra chupacambra commented Jul 30, 2019

You rock Brad! Keep up the good work.

@HusainMansuri1

This comment has been minimized.

Copy link

@HusainMansuri1 HusainMansuri1 commented Jan 29, 2020

Just Perfect!

@mike-4040

This comment has been minimized.

Copy link

@mike-4040 mike-4040 commented Feb 13, 2020

Great list, thanks.

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

@Mubirupatrick2040

This comment has been minimized.

Copy link

@Mubirupatrick2040 Mubirupatrick2040 commented Feb 21, 2020

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

@Yoloko

This comment has been minimized.

Copy link

@Yoloko Yoloko commented May 23, 2020

thank you !

@edu1988

This comment has been minimized.

Copy link

@edu1988 edu1988 commented Jun 9, 2020

Thank you very much!

@irtiza-khan

This comment has been minimized.

Copy link

@irtiza-khan irtiza-khan commented Aug 23, 2020

Thank You Brad your tutorials helps alot

@TheHumbleAngy

This comment has been minimized.

Copy link

@TheHumbleAngy TheHumbleAngy commented Aug 25, 2020

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

@Deltaty-Code

This comment has been minimized.

Copy link

@Deltaty-Code Deltaty-Code commented Nov 2, 2020

thank you so much , very helpful

@Ujjawal0619

This comment has been minimized.

Copy link

@Ujjawal0619 Ujjawal0619 commented Dec 29, 2020

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

@Ksound22

This comment has been minimized.

Copy link

@Ksound22 Ksound22 commented Jan 6, 2021

Old but gold

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.