---
title: "Migrating from pnpm to vlt"
description: "Documentation for the vlt client and the vlt registry."
url: "https://docs.vlt.io/client/migration/from-pnpm"
image: "https://docs.vlt.io/og/client/migration/from-pnpm"
lang: "en"
---

# Migrating from pnpm to vlt

## Quick Start

```bash title="Terminal"
# Install vlt globally
$ npm install -g vlt

# Optional: keep npm's registry -- vlt installs through its public npm mirror by default

$ vlt config set registries.npm=https://registry.npmjs.org/

# In your existing project, run:

$ vlt install $ vlt build
```

Unlike pnpm, **vlt's default registry is vlt's public npm mirror** (`https://registry.vlt.io/upstream/npm/`, read-only, with usage limits), so package metadata and tarballs come from `registry.vlt.io` with no config. The optional snippet above switches back to the public npm registry; if you have a vlt.io account, run [`vlt setup`](https://docs.vlt.io/client/registries.md#getting-started-with-vlt-setup) instead to use your account's npm mirror (no usage limits). See [Registries](https://docs.vlt.io/client/registries.md).

vlt reads your existing `package.json` files and resolves dependencies. The `pnpm-lock.yaml` file is not migrated — vlt performs a fresh resolution and creates `vlt-lock.json`.

---

## Command Mapping

| pnpm                             | vlt                             | Notes                                                                                       |
| -------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------- |
| `pnpm install`                   | `vlt install`                   | Does **not** run lifecycle scripts                                                          |
| `pnpm add <pkg>`                 | `vlt install <pkg>`             |                                                                                             |
| `pnpm add -D <pkg>`              | `vlt install -D <pkg>`          |                                                                                             |
| `pnpm remove <pkg>`              | `vlt uninstall <pkg>`           |                                                                                             |
| `pnpm run <script>`              | `vlt run <script>`              |                                                                                             |
| `pnpm <script>`                  | `vlt run <script>`              | See [fallback-command](https://docs.vlt.io/client/configuring.md#--fallback-commandcommand) |
| `pnpm dlx <pkg>`                 | `vlx <pkg>`                     | Run remote packages                                                                         |
| `pnpm exec <cmd>`                | `vlt exec <cmd>`                |                                                                                             |
| `pnpm init`                      | `vlt init`                      |                                                                                             |
| `pnpm pack`                      | `vlt pack`                      |                                                                                             |
| `pnpm publish`                   | `vlt publish`                   |                                                                                             |
| `pnpm login`                     | `vlt login`                     |                                                                                             |
| `pnpm whoami`                    | `vlt whoami`                    |                                                                                             |
| `pnpm list`                      | `vlt list`                      |                                                                                             |
| `pnpm why <pkg>`                 | `vlt query '#<pkg>'`            | DSS query; see [Selectors](https://docs.vlt.io/client/selectors.md)                         |
| `pnpm install --frozen-lockfile` | `vlt install --frozen-lockfile` |                                                                                             |
| `pnpm audit`                     | `vlt query ':malware'`          | More powerful; see [Security](https://docs.vlt.io/client/security.md)                       |
| `pnpm config set <key> <val>`    | `vlt config set <key>=<val>`    |                                                                                             |

### Shorthand Script Execution

pnpm lets you run scripts without `run` (e.g., `pnpm build`). vlt supports this via the `fallback-command` config:

```bash title="Terminal"
$ vlt config set fallback-command=run-exec
```

After setting this, `vlt build` will first check for a vlt command named `build`, and if none matches, look for a `package.json` script.

---

## Configuration

### .npmrc + pnpm-workspace.yaml → vlt.json

pnpm reads registry config from `.npmrc` and workspace config from `pnpm-workspace.yaml`. vlt consolidates everything into `vlt.json`. vlt also reads the `packages` list of `pnpm-workspace.yaml`, and `vlt install` copies it to `vlt.json`.

**pnpm configuration:**

```ini title=".npmrc"
# .npmrc (pnpm)
registry=https://registry.internal.company.com/
@mycompany:registry=https://npm.mycompany.com/
auto-install-peers=true
```

```yaml title="pnpm-workspace.yaml"
# pnpm-workspace.yaml
packages:
- "packages/*"
- "apps/*"
```

**vlt equivalent (single file):**

```json title="vlt.json"
{
  "registry": "https://registry.internal.company.com/",
  "scoped-registries": {
    "@mycompany": "https://npm.mycompany.com/"
  },
  "workspaces": [
    "packages/*",
    "apps/*"
  ]
}
```

---

## Registry Configuration

### Scoped Registries

pnpm's scoped registries (from `.npmrc`) map directly to vlt's `scoped-registries`:

```json title="vlt.json"
{
  "scoped-registries": {
    "@mycompany": "https://npm.mycompany.com/"
  }
}
```

### Named Registry Aliases

vlt also supports [named registry aliases](https://docs.vlt.io/client/registries.md) which remove the ambiguity of scope-based mapping:

```json title="vlt.json"
{
  "registries": {
    "internal": "https://npm.mycompany.com/"
  }
}
```

Then reference packages explicitly in `package.json`:

```json title="package.json"
{
  "dependencies": {
    "@mycompany/utils": "internal:@mycompany/utils@^2.0"
  }
}
```

---

## Authentication

pnpm stores auth tokens in `.npmrc`, same as npm. vlt stores them in an XDG-compliant keychain file, keeping secrets out of project config files.

```bash title="Terminal"
# Log in to default registry
$ vlt login

# Log in to custom registry

$ vlt login --registry=https://npm.mycompany.com/
```

### CI Environments

```bash title="Terminal"
# pnpm
NPM_TOKEN=abc123 pnpm install

# vlt

VLT_TOKEN=abc123 vlt install
```

See [Authentication](https://docs.vlt.io/client/auth.md) for full details.

---

## Lockfile

pnpm uses `pnpm-lock.yaml`. vlt uses `vlt-lock.json`.

When you first run `vlt install`, vlt creates `vlt-lock.json` from a fresh resolution of your `package.json` files. The `pnpm-lock.yaml` is not read.

**What to do:**

1. Run `vlt install` to generate `vlt-lock.json`
2. Commit `vlt-lock.json`
3. Optionally remove `pnpm-lock.yaml` once you've fully switched

---

## Install Script Protection

pnpm runs lifecycle scripts by default during install (same as npm). pnpm v9+ added `onlyBuiltDependencies` in `package.json` as an allowlist, but scripts still run by default for listed packages.

**vlt** takes a different approach: `vlt install` runs **no scripts at all** by default. Building is a separate, explicit step:

```bash title="Terminal"
# Phase 1: Install (no code executes)
$ vlt install

# Phase 2: Build (runs scripts, skipping known malware)

$ vlt build
```

By default, `vlt build` uses the target `:scripts:not(:built):not(:malware)` — it automatically skips packages flagged as malware by [Socket](https://socket.dev/).

### pnpm onlyBuiltDependencies vs vlt allow-scripts

```json title="package.json (pnpm)"
{
  "pnpm": {
    "onlyBuiltDependencies": [
      "esbuild",
      "node-gyp"
    ]
  }
}
```

```bash title="Terminal (vlt)"
$ vlt build '#esbuild, #node-gyp'
```

It saves the query as `allow-scripts` in `vlt.json`: installs then run those scripts.

See [`vlt build`](https://docs.vlt.io/client/commands/build.md) for full details.

---

## Workspaces

### pnpm

pnpm defines workspaces in `pnpm-workspace.yaml`:

```yaml title="pnpm-workspace.yaml"
packages:
- "packages/*"
- "apps/*"
```

### vlt

vlt reads that `packages` list, and `vlt install` copies it to `vlt.json`, vlt's own place for workspaces (see [Workspaces](https://docs.vlt.io/client/workspaces.md#saving-workspaces-to-vltjson)). `pnpm-workspace.yaml` is left as-is. Commit `vlt.json`: `vlt ci` reads workspaces from it only, and later `pnpm-workspace.yaml` edits are ignored by vlt:

```json title="vlt.json"
{
  "workspaces": [
    "packages/*",
    "apps/*"
  ]
}
```

Local packages referenced with the `workspace:` protocol keep working as-is. If you relied on `link-workspace-packages` and plain ranges instead, `vlt install` rewrites the ones that link a workspace to `workspace:*` in each `package.json`, see [Rewriting workspace references](https://docs.vlt.io/client/workspaces.md#rewriting-workspace-references). pnpm reads `workspace:*` too. To keep the plain ranges instead, set `"migrate-workspaces": false` in the `config` of `vlt.json`, add the `workspaces` field there yourself, and add `":project > :workspace": "workspace:*"` to `modifiers` to always link them, see [Implicit workspace references](https://docs.vlt.io/client/graph-modifiers.md#implicit-workspace-references).

vlt also supports **named workspace groups**:

```json title="vlt.json"
{
  "workspaces": {
    "apps": "apps/*",
    "libs": [
      "packages/*",
      "shared/*"
    ]
  }
}
```

### Workspace Commands

| pnpm                               | vlt                                               |
| ---------------------------------- | ------------------------------------------------- |
| `pnpm --filter <name> <cmd>`       | `vlt <cmd> -w <path>` or `cd <path> && vlt <cmd>` |
| `pnpm --filter ./packages/* <cmd>` | `vlt <cmd> -w packages/*`                         |
| `pnpm -r <cmd>`                    | `vlt <cmd> --recursive`                           |
| `pnpm -r run test`                 | `vlt run test --recursive`                        |

**Note:** vlt's `--workspace` (`-w`) flag takes paths or glob patterns, not package names.

```bash title="Terminal"
# Run tests in a specific workspace
$ vlt run test -w packages/core

# Run build across a workspace group

$ vlt run build --workspace-group libs
```

See [Workspaces](https://docs.vlt.io/client/workspaces.md) for full details.

---

## Catalogs

If you use pnpm's catalog feature (`pnpm-workspace.yaml`), vlt has direct support for [catalogs](https://docs.vlt.io/client/catalogs.md) with compatible syntax. vlt doesn't read `catalog`/`catalogs` from `pnpm-workspace.yaml`; move them to `vlt.json`, else `catalog:` specs fail with a [catalog error](https://docs.vlt.io/client/catalogs.md#error-handling).

**pnpm:**

```yaml title="pnpm-workspace.yaml"
# pnpm-workspace.yaml
packages:
- "packages/*"

catalog: typescript: "^5.0.0" eslint: "^8.0.0"

catalogs: testing: vitest: "^1.0.0"
```

**vlt:**

```json title="vlt.json"
{
  "workspaces": [
    "packages/*"
  ],
  "catalog": {
    "typescript": "^5.0.0",
    "eslint": "^8.0.0"
  },
  "catalogs": {
    "testing": {
      "vitest": "^1.0.0"
    }
  }
}
```

The `catalog:` protocol in `package.json` works the same way:

```json title="package.json"
{
  "devDependencies": {
    "typescript": "catalog:",
    "vitest": "catalog:testing"
  }
}
```

See [Catalogs](https://docs.vlt.io/client/catalogs.md) for full details.

---

## Overrides → Graph Modifiers

pnpm uses `pnpm.overrides` in `package.json`. vlt uses [Graph Modifiers](https://docs.vlt.io/client/graph-modifiers.md) in `vlt.json`.

```json title="package.json (pnpm)"
{
  "pnpm": {
    "overrides": {
      "lodash": "^4.17.21",
      "express>qs": "6.10.0"
    }
  }
}
```

```json title="vlt.json"
{
  "modifiers": {
    "#lodash": "^4.17.21",
    ":root > #express > #qs": "=6.10.0"
  }
}
```

Graph Modifiers use DSS selectors, giving you more precise control (e.g., target by path, workspace, or semver range).

pnpm's `"-"` override value maps to the same `"-"` modifier value, see [Removing Dependencies](https://docs.vlt.io/client/graph-modifiers.md#removing-dependencies).

---

## node_modules Layout

pnpm uses a content-addressable store with symlinks to create a strict `node_modules` layout where packages can only access their declared dependencies.

vlt also creates a `node_modules` directory but uses a different internal layout (under `node_modules/.vlt/`). The result is similar in that packages resolve correctly at runtime — your application code doesn't need to change.

---

## Features Not in vlt

Some pnpm-specific features don't have direct equivalents:

- **Side-effects cache** — Not available in vlt
- **`pnpm patch`** — Not yet available in vlt
- **`pnpm deploy`** — Not available; use standard deployment tooling
- **`pnpm.peerDependencyRules`** — vlt handles peer dependencies automatically with [context isolation](https://docs.vlt.io/client/peer-dependencies.md)

---

## Migration Checklist

1. Install vlt: `npm install -g vlt`
2. Create `vlt.json` with your `.npmrc` registry config (`vlt install` copies `pnpm-workspace.yaml` `packages` to it)
3. Move scoped registry config from `.npmrc` to `vlt.json`
4. Move catalogs from `pnpm-workspace.yaml` to `vlt.json` (`catalog` and `catalogs` fields)
5. Move `pnpm.overrides` from `package.json` to `modifiers` in `vlt.json`
6. Run `vlt install` then `vlt build`; local packages referenced by plain ranges (`link-workspace-packages`) are rewritten to `workspace:*` (to keep plain ranges instead, see [Workspaces](https://docs.vlt.io/client/migration/from-pnpm#workspaces) first)
7. Commit `vlt.json`, `vlt-lock.json` and the `package.json` files
8. Update CI scripts: replace `pnpm install --frozen-lockfile` with `vlt install --frozen-lockfile && vlt build`
9. Update CI auth: replace `NPM_TOKEN` with `VLT_TOKEN`
10. Update any `pnpm dlx` usage to `vlx`
11. Remove `pnpm-workspace.yaml` and pnpm-specific `.npmrc` settings once no other tool reads them
