Skip to content

vlt install should prioritize registry config changes over existing lockfile #1579

Description

@vltbaudbot

Feature Request

When the registry configuration value is changed (e.g. switching from registry.npmjs.org to a custom/private registry), vlt install should detect the registry change and re-resolve dependencies from the new registry, rather than continuing to use the registry URLs stored in the existing lockfile.

Current Behavior

After changing the registry config, running vlt install continues to use the registry URLs from the existing vlt-lock.json. The only way to switch registries is to delete the entire lockfile and regenerate from scratch.

Expected Behavior

vlt install should detect that the configured registry differs from what the lockfile was built against, and re-resolve dependencies from the new registry. This could be:

  1. Automatic: detect the registry mismatch and re-resolve all affected entries
  2. Prompted: warn the user about the mismatch and offer to re-resolve
  3. Flagged: provide a CLI flag (e.g. --update-registry) to explicitly trigger re-resolution from the new registry

Use Case

Teams migrating between registries (e.g. npm → private registry, or npm → registry.vlt.io) need a clean way to switch without manually rebuilding the entire lockfile. This is especially important for monorepos where the lockfile can be large and complex.

Context

Discovered while working on registry migration in the vlt.io monorepo — changing the registry config required a full lockfile rebuild to take effect.

Activity

  1. added
    cli
    feature
    on May 1, 2026
  2. added
    Release 1.0.0
    on May 1, 2026
  3. removed
    Release 1.0.0
    on Aug 3, 2026
  4. ruy-bot commented on Sep 14, 2026

    @ruy-bot
    Contributor

    Adding a verified reproduction from a user-feedback triage (2026-09-11, vlt 1.0.8, behaviour unchanged at current main), since this gap is what forces the Quick Start's "delete your lockfile" step (#1846):

    • Project with an existing vlt-lock.json built against registry.npmjs.org; switch registries.npm in vlt.json to a local registry (http://127.0.0.1:4899/acme/npm/).
    • vlt install rewrote options.registries in the lockfile, but every node kept its resolved tarball URL and the client fetched https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz (confirmed via the registry-client cache .key files). The new registry was never contacted.

    For comparison, kept lockfiles migrate cleanly with the other clients: npm has replace-registry-host (on by default) and rewrites the host of resolved URLs at fetch time; pnpm stores no tarball URLs at all. A replace-registry-host-style rewrite at fetch time (map a node's resolved host onto the currently configured registry for that node's registry alias) would cover the migration use case without re-resolving versions, and could be the "automatic" option listed above.

    This matters for the vlt.io mirror migration story: switching a vlt project to registry.vlt.io/<account>/npm/ today silently keeps all traffic on npmjs, and fails outright where npmjs is firewalled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clifeature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions