# lpm resolve (/docs/packages/resolve)



```bash
lpm resolve <packages...>
```

Runs the resolver against the given specs and prints the dependency tree it would install. **Read-only** — no filesystem changes, no lockfile, no downloads, no `package.json` mutation.

Useful for previewing the impact of a candidate dep, debugging unexpected transitive selections, or scripting dep-graph analysis (`--json` makes the output structured).

## Examples [#examples]

```bash
lpm resolve react                            # latest, full tree
lpm resolve react@^19                        # a specific range
lpm resolve react vue zod                    # multiple at once
lpm resolve @lpm.dev/owner.pkg               # @lpm.dev/* through LPM.dev Registry
lpm resolve @my-co/internal                  # through the current project's .npmrc scoped registry
lpm resolve react --json | jq '.packages'    # structured output for scripts
```

## Spec format [#spec-format]

Each spec is `<name>` or `<name>@<range>`. Bare names default to `*` (latest matching anything). Scoped names work as expected — the parser handles the leading `@` correctly so `@lpm.dev/owner.pkg@^1.0.0` parses as `(name=@lpm.dev/owner.pkg, range=^1.0.0)`.

| Spec                    | Resolves to                       |
| ----------------------- | --------------------------------- |
| `react`                 | Latest react                      |
| `react@^19`             | Latest react matching `^19`       |
| `react@19.0.0`          | Exact `19.0.0`                    |
| `react@beta`            | Latest tag `beta`                 |
| `@lpm.dev/owner.pkg@^1` | Latest `^1` from LPM.dev Registry |

## How it works [#how-it-works]

1. Parses each spec into `(name, range)`.
2. Calls the resolver with the combined dep map. `@lpm.dev/*` names route to LPM.dev Registry; `.npmrc`-declared scoped or default registries are honored for npm/private packages; everything else resolves against npmjs.org.
3. Prints the resolved tree as `name@version` rows, nesting transitives under their parent with tree edges.

No tarballs are downloaded. The resolver only needs metadata.

Human output is written as a readable tree:

```text
react@19.0.0
  └─ scheduler@0.25.0
```

## JSON output [#json-output]

```bash
lpm resolve react --json
```

```json
{
  "success": true,
  "count": 47,
  "elapsed_secs": 0.83,
  "packages": [
    { "package": "react", "version": "19.0.0" },
    { "package": "scheduler", "version": "0.25.0" }
  ]
}
```

| Field                | Type     | Notes                                        |
| -------------------- | -------- | -------------------------------------------- |
| `count`              | `number` | Total resolved packages (root + transitive). |
| `elapsed_secs`       | `number` | Resolver wall-clock time.                    |
| `packages[].package` | `string` | Package name.                                |
| `packages[].version` | `string` | Resolved exact version.                      |

Integrity hashes aren't part of the resolve envelope — pair with [`lpm download`](/docs/packages/download) to fetch the tarball + SRI for a specific resolved version.

## When to reach for this [#when-to-reach-for-this]

* Preview the transitive impact of adding a new dep before touching `package.json`.
* Investigate why a specific transitive version got picked. Pair with `--json` and `jq` for ad-hoc analysis.
* Generate dep-graph fixtures for testing.
* Check whether a candidate version has unexpected peer-dep conflicts.

For installing the result, run `lpm install <spec>`. For just downloading the tarball, use [`lpm download`](/docs/packages/download).

## Flags [#flags]

`lpm resolve` takes no specific flags. Use the [global flags](/docs/commands#global-flags) — `--json` is especially useful here, and `--registry` / `--token` route the lookup against a specific endpoint or session.

## See also [#see-also]

* [`lpm install`](/docs/packages/install) — installs the resolved tree
* [`lpm download`](/docs/packages/download) — fetch + extract the tarball without installing
* [`lpm graph`](/docs/packages/graph) — visualize the dep tree of an already-installed project
* [Resolver](/docs/packages/resolver) — design overview
