Skip to main content

Overview

The pm ls command lists installed dependencies in your project. It’s a passthrough to your package manager’s native ls command, with automatic handling of package manager differences.

Syntax

pm ls [...args]

Arguments

args
string[]
Additional arguments to pass to the underlying package manager’s ls command

Examples

List All Dependencies

pm ls
Output (pnpm)
Running: pnpm ls

[email protected] /path/to/project
├─┬ express 4.18.2
 ├── accepts 1.3.8
 ├── array-flatten 1.1.1
 └── body-parser 1.20.1
└── typescript 5.0.0

List Specific Package

pm ls express
Output
Running: pnpm ls express

[email protected] /path/to/project
└── express 4.18.2

List with Depth

pm ls --depth=0
Output
Running: pnpm ls --depth=0

[email protected] /path/to/project
├── express 4.18.2
├── react 18.2.0
└── typescript 5.0.0

List Dev Dependencies

pm ls --dev
Output
Running: pnpm ls --dev

List Production Dependencies

pm ls --prod
Output
Running: pnpm ls --prod

Package Manager Differences

Better PM handles differences between package managers automatically:
pm ls
# Runs: pnpm ls
From src/commands/ls.ts:14-17:
const cmd =
  pm.name === 'bun'
    ? ShellCommand.make('bun', 'pm', 'ls', ...passthrough)
    : ShellCommand.make(pm.name, 'ls', ...passthrough);
Bun requires bun pm ls instead of just bun ls, which Better PM handles automatically.

Common Use Cases

Check Dependency Version

pm ls typescript

Verify Installation

pm ls react react-dom

List Top-Level Dependencies

pm ls --depth=0

Find Dependency Issues

pm ls --long

List Global Packages

pm ls --global

Output Format

The output shows:
  • Package name and version at the root level
  • Dependency tree with proper nesting
  • Versions for each installed package
  • Missing or invalid dependencies (marked with WARN or ERR)

Supported Arguments

Common arguments that work across package managers:
ArgumentDescription
--depth=<n>Limit dependency tree depth
--devList only dev dependencies
--prodList only production dependencies
--globalList globally installed packages
--jsonOutput as JSON
--longShow extended information
--parseableOutput parseable format
Use --json for programmatic parsing of dependency information.
  • pm pls - List workspace packages (monorepo)
  • pm why - Explain why a package is installed
  • pm install - Install dependencies