# lpm uninstall (/docs/packages/uninstall)



```bash
lpm uninstall <packages...>   # aliases: lpm un, lpm unlink
```

Drops one or more packages from `package.json`, removes them from `node_modules`, removes any local `node_modules/.bin` shims owned by those packages, and rewrites `lpm.lock` plus `lpm.lockb` when the post-uninstall graph fits the binary format. When a removed package makes transitive packages unreachable, LPM CLI prunes those orphaned entries from both the lockfile and `node_modules`, removes their owned bin shims as well, then cleans up empty scoped-package directories such as `node_modules/@scope/`.

`lpm uninstall` only touches `dependencies` and `devDependencies&#x60;. **`peerDependencies`, `optionalDependencies`, and `lpm > trustedDependencies` are intentionally left alone** — a peer-dep declaration is a contract with consumers and shouldn't disappear when the underlying package is removed; trust entries persist so that re-adding the same `name@version` doesn't silently re-open the script-trust review. Clean stale trust entries with [`lpm trust prune`](/docs/packages/trust#lpm-trust-prune).

To remove a globally-installed CLI, pass `-g`. To remove source files added with [`lpm add`](/docs/packages/add), use [`lpm remove`](/docs/packages/remove).

Human output reports the direct removals and any orphaned transitives:

```text
- @scope/root@1.0.0
- @scope/leaf@1.0.0 (orphaned)
✓ Cleaned empty directories
✓ Freed 42 B on disk
✓ Done · removed 1 package in 42ms
```

## Examples [#examples]

```bash
lpm uninstall lodash
lpm un react react-dom            # multiple at once
lpm uninstall -g typescript       # remove a global install
lpm uninstall lodash --filter web # workspace member only
lpm uninstall -w eslint           # remove from workspace root
```

## Workspaces [#workspaces]

In a monorepo, target a specific member or the workspace root:

```bash
lpm uninstall lodash --filter web   # remove from packages/web/
lpm uninstall lodash --filter-prod ...web # prod dependency closure only
lpm uninstall -w eslint             # remove from the root package.json
```

`--filter` / `--filter-prod` and `-w` are mutually exclusive. `--filter-prod` uses the same grammar but ignores `devDependencies` during closure expansion. `--changed-files-ignore-pattern <glob>` and `--test-pattern <glob>` apply when a filter contains a `[git-ref]` atom. `--fail-if-no-match` makes a typo'd filter exit non-zero (recommended in CI). When uninstall would mutate more than one member's `package.json`, LPM CLI prompts for confirmation; pass `-y` to skip the prompt.

See [Workspaces](/docs/packages/workspaces) for filter grammar.

## Global [#global]

```bash
lpm uninstall -g eslint
# Equivalent to: lpm global remove eslint
```

`--global` is mutually exclusive with filters / `-w` / `--fail-if-no-match` (those are project-scoped). Both invocations route through the same global-uninstall implementation.

## Flags [#flags]

| Flag                                    | Effect                                                                                            |
| --------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `-g`, `--global`                        | Remove a globally-installed package from `~/.lpm/global/`                                         |
| `--filter <EXPR>`                       | Workspace filter (mutually exclusive with `-w` and `-g`)                                          |
| `--filter-prod <EXPR>`                  | Workspace filter with production-only dependency closures (mutually exclusive with `-w` and `-g`) |
| `--changed-files-ignore-pattern <glob>` | Ignore matching git-diff paths for `[git-ref]` filters                                            |
| `--test-pattern <glob>`                 | Treat matching git-diff paths as test-only for `[git-ref]` fan-out decisions                      |
| `-w`, `--workspace-root`                | Target the workspace root `package.json`                                                          |
| `--fail-if-no-match`                    | Exit non-zero if filters match no members                                                         |
| `-y`, `--yes`                           | Skip the multi-member confirmation prompt                                                         |

Plus the [global flags](/docs/commands#global-flags).

## See also [#see-also]

* [`lpm install`](/docs/packages/install) — the forward direction
* [`lpm remove`](/docs/packages/remove) — undo an `lpm add` (different command)
* [`lpm global`](/docs/packages/global) — manage globally-installed CLIs
* [Workspaces](/docs/packages/workspaces)
