> ## Documentation Index
> Fetch the complete documentation index at: https://better-pm.fdarian.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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

```bash theme={null}
pm ls [...args]
```

## Arguments

<ParamField path="args" type="string[]">
  Additional arguments to pass to the underlying package manager's ls command
</ParamField>

## Examples

### List All Dependencies

```bash theme={null}
pm ls
```

```bash Output (pnpm) theme={null}
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

```bash theme={null}
pm ls express
```

```bash Output theme={null}
Running: pnpm ls express

my-app@1.0.0 /path/to/project
└── express 4.18.2
```

### List with Depth

```bash theme={null}
pm ls --depth=0
```

```bash Output theme={null}
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

```bash theme={null}
pm ls --dev
```

```bash Output theme={null}
Running: pnpm ls --dev
```

### List Production Dependencies

```bash theme={null}
pm ls --prod
```

```bash Output theme={null}
Running: pnpm ls --prod
```

## Package Manager Differences

Better PM handles differences between package managers automatically:

<CodeGroup>
  ```bash pnpm theme={null}
  pm ls
  # Runs: pnpm ls
  ```

  ```bash bun theme={null}
  pm ls
  # Runs: bun pm ls
  ```

  ```bash npm theme={null}
  pm ls
  # Runs: npm ls
  ```
</CodeGroup>

From `src/commands/ls.ts:14-17`:

```typescript theme={null}
const cmd =
  pm.name === 'bun'
    ? ShellCommand.make('bun', 'pm', 'ls', ...passthrough)
    : ShellCommand.make(pm.name, 'ls', ...passthrough);
```

<Note>
  Bun requires `bun pm ls` instead of just `bun ls`, which Better PM handles automatically.
</Note>

## Common Use Cases

### Check Dependency Version

```bash theme={null}
pm ls typescript
```

### Verify Installation

```bash theme={null}
pm ls react react-dom
```

### List Top-Level Dependencies

```bash theme={null}
pm ls --depth=0
```

### Find Dependency Issues

```bash theme={null}
pm ls --long
```

### List Global Packages

```bash theme={null}
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           |

<Tip>
  Use `--json` for programmatic parsing of dependency information.
</Tip>

## Related Commands

* [pm pls](/commands/pls) - List workspace packages (monorepo)
* [pm why](/commands/why) - Explain why a package is installed
* [pm install](/commands/install) - Install dependencies
