Brent Keller

npm cheatsheet

Here are some npm (node package manager) commands that I've found useful.

Listing installed packages

# List global packages
npm ls -g

The full global list is often way more info than you really want, so it can be helpful to limit it to root-level packages (e.g. installed via npm i -g <package>) using the --depth-0 flag.

# List global, root-level packages
npm ls -g --depth=0

You can also list the root-level packages that have been installed via npm link rather than npm i with the --link=true flag.

# List global, root-level packages installed via a `npm link`
npm ls -g --depth=0 --link=true
© 2023 Brent Keller