Show Menu
Cheatography

Node Package Manager Cheat Sheet by

Quick Reference for NPM

Links

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>
   
 

Comments

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          JavaScript Cheat Sheet
          SailsJS Cheat Sheet
          Yarn Package Manager Cheat Sheet

          More Cheat Sheets by GregFinzer

          Salesforce CLI Cheat Sheet
          Angular CLI Cheat Sheet
          Elasticsearch Example Queries Cheat Sheet