pm ls
List installed dependencies
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
Running: pnpm ls
my-app@1.0.0 /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
Running: pnpm ls express
my-app@1.0.0 /path/to/project
└── express 4.18.2
List with Depth
pm ls --depth=0
Running: pnpm ls --depth=0
my-app@1.0.0 /path/to/project
├── express 4.18.2
├── react 18.2.0
└── typescript 5.0.0
List Dev Dependencies
pm ls --dev
Running: pnpm ls --dev
List Production Dependencies
pm ls --prod
Running: pnpm ls --prod
Package Manager Differences
Better PM handles differences between package managers automatically:
pm ls
# Runs: pnpm lspm ls
# Runs: bun pm lspm ls
# Runs: npm lsFrom src/commands/ls.ts:14-17:
const cmd =
pm.name === 'bun'
? ShellCommand.make('bun', 'pm', 'ls', ...passthrough)
: ShellCommand.make(pm.name, 'ls', ...passthrough);
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:
| Argument | Description |
|---|---|
--depth=<n> |
Limit dependency tree depth |
--dev |
List only dev dependencies |
--prod |
List only production dependencies |
--global |
List globally installed packages |
--json |
Output as JSON |
--long |
Show extended information |
--parseable |
Output parseable format |
Related Commands
- pm pls - List workspace packages (monorepo)
- pm why - Explain why a package is installed
- pm install - Install dependencies