Show Menu

Node Package Manager Cheat Sheet by

Quick Reference for NPM
node     npm

Install Packages

Install a package and the update packag­e.json with the package name and version
npm install <pa­ckage name> --save
Install Latest Version of a Package do not update packag­e.json
npm install <pa­ckage name>
Install Specific Package Version
npm install <pa­cka­ge-­nam­e>@­<ve­rsi­on-­num­ber>
Install a scoped package
npm install @<n­ame­spa­ce>­/<p­ack­age­-na­me>
Install to dev depend­encies
npm install <pa­cka­ge-­nam­e> --save-dev
Install package globally
npm install <pa­cka­ge-­nam­e> -g
Install from GitHub
npm install <Gi­tHu­b-U­RL>
Install from a folder (for private packages)
npm install <pa­th>
Restore packages defined in packag­e.json
npm install
Find the Global Install Directory
npm config get prefix

Uninstall Packages

Uninstall and remove from packag­e.json
npm uninstall <pa­cka­ge-­nam­e> --save
Uninstall Package
npm uninstall <pa­cka­ge-­nam­e>
Uninstall Global Package
npm uninstall -g <pa­cka­ge-­nam­e>
Remove extraneous (unused) packages
npm prune
Clear from the NPM Cache
npm cache clean

List Packages

List packages used by your applic­ation no depend­encies
npm ls --depth 0
List packages used by your applic­ation with depend­encies
npm ls
List packages installed globally no depend­encies
npm ls -g --depth 0
List packages and depend­encies installed globally
npm ls -g true
List dev depend­encies
npm ls --dev true
List prod depend­encies
npm ls --prod true
Show the latest version of a package on npm
npm view <pa­cka­ge-­nam­e> version
Show current version of a local npm package
npm show <pa­cka­ge-­nam­e> version

Help

Get general help
npm -h
Get help about a command
npm <co­mma­nd-­nam­e> -h
Go to help page about command
npm help <co­mma­nd-­nam­e>
Go to the repository for the page
npm repo <pa­cka­ge-­nam­e>

Download the Node Package Manager Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/gregfinzer_node-package-manager.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

Like this cheat sheet? Check out our sponsors!

Readable.io is a collection of tools to make your writing better. More readable content means higher conversion rates and better reader engagement. Measure website and document readability, measure keyword density and more!

Click Here To Get Started!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          JavaScript Cheat Sheet
          Yarn Package Manager Cheat Sheet
          SailsJS Cheat Sheet

          More Cheat Sheets by GregFinzer

          MSTest Cheat Sheet
          MOQ Cheat Sheet