Skip to content

vp run skips pnpm's verifyDepsBeforeRun, so scripts run against stale node_modules #3091

Open

Description

@Luzivog

Description

pnpm 11 made verifyDepsBeforeRun: install the default. Before pnpm run or pnpm exec, pnpm checks that node_modules matches the lockfile and the manifests, and installs first if it doesn't. The check takes about 10 ms when nothing changed.

vp run <script> runs the same package.json scripts itself and does no such check. So after a git pull, a merge or a branch switch that changes the lockfile, pnpm run test works, while vp run test fails with Cannot find module … against stale dependencies.

Tested with vite-plus 1.2.0 and pnpm 12.11.2 on Linux:

  • In a workspace with a stale lockfile, pnpm run <script> installed and then ran.
  • vp run <script> failed with Cannot find module.
  • An strace -e execve of vp run --filter <pkg> lint shows no pnpm process starting.
  • Nothing overrides verifyDepsBeforeRun in the workspace, .npmrc, user config or environment.

Suggested solution

When the workspace's package manager is pnpm, have vp run apply pnpm's verifyDepsBeforeRun setting before running a package.json script: run pnpm's own check, or install, warn or fail as the setting says. With npm, yarn or bun, keep today's behaviour.

Alternative

Document that vp run skips the package manager's dependency check, so teams that rely on it run scripts through pnpm run.

Additional context

This is how our agents and developers got stale node_modules after merges. We now run package scripts with pnpm for this reason.

Validations

  • Read the Contributing Guidelines.
  • Confirm this request is for Vite+ itself and not for Vite, Vitest, tsdown, Rolldown, or Oxc.
  • Check that there isn't already an issue requesting the same feature. I searched vite-plus and vite-task for verifyDepsBeforeRun, verify-deps-before-run and stale dependencies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions