Repository navigation
Description
Describe the bug
runViteInstall (packages/cli/src/utils/prompts.ts) adds --ignore-scripts to the install vp migrate runs when the project uses pnpm 11 or later. The aim is to keep an unapproved build script from failing the install with ERR_PNPM_IGNORED_BUILDS. The comment says the user's own next vp install keeps pnpm's default behavior.
That does not hold for a git dependency whose files come from prepare, even when its build is approved in allowBuilds:
- The migration aliases
viteto the core. That changes the peers of any dependency with avitepeer, so pnpm puts the git dependency into a new virtual-store directory. --ignore-scriptsskips itspreparethere, so itsdist/is never built.- The next
vp installreports "Already up to date", and pnpm'srebuilddoes not run a skippedprepareeither (pnpm rebuildnever runs a git-hosted dependency'spreparethat--ignore-scriptsskipped; onlypnpm install --forcedoes pnpm/pnpm#18551). - Only
pnpm install --forcebringsdist/back. Until then the build fails to resolve the package.
We migrated four game projects that consume a shared UI library as a git dependency pinned to a commit, with its build allowed in allowBuilds. All four lost the library's dist/ this way.
pnpm already has a setting for what the flag is used for: strictDepBuilds. With --config.strict-dep-builds=false instead of --ignore-scripts, the same install exits 0. Builds that are approved (here the git dependency's prepare) still run, and the unapproved ones are skipped and listed for pnpm approve. Measured on the reproduction below, with a second git dependency added whose build (a postinstall) is not in allowBuilds:
| Install after the migration edit | Exit | Approved git dependency's dist/ |
Unapproved build |
|---|---|---|---|
pnpm install (default, strict) |
1, ERR_PNPM_IGNORED_BUILDS |
built | skipped |
pnpm install --ignore-scripts (what migrate runs) |
0 | missing | skipped |
pnpm install --config.strict-dep-builds=false |
0 | built | skipped, "Run pnpm approve" |
If this direction works for you, I can send a PR that makes the auto-install pass --config.strict-dep-builds=false instead of --ignore-scripts on pnpm ≥ 11.
Reproduction
Steps below (a local git repository stands in for the library; no remote needed).
Steps to reproduce
set -eu
root=$(mktemp -d)
cd "$root"
# The library: dist/ comes from prepare, and vite is an optional peer.
mkdir lib
cd lib
cat >package.json <<'EOF'
{
"name": "lib",
"version": "1.0.0",
"type": "module",
"files": ["dist"],
"exports": { ".": "./dist/index.js" },
"scripts": { "prepare": "node -e \"require('fs').mkdirSync('dist',{recursive:true});require('fs').writeFileSync('dist/index.js','export default 1')\"" },
"peerDependencies": { "vite": "*" },
"peerDependenciesMeta": { "vite": { "optional": true } }
}
EOF
echo dist >.gitignore
git init -q && git add -A && git commit -qm init
cd ..
LIB="git+file://$root/lib#$(git -C lib rev-parse HEAD)"
mkdir app
cd app
cat >package.json <<EOF
{
"name": "app",
"private": true,
"type": "module",
"packageManager": "pnpm@12.23.0",
"scripts": { "build": "vite build" },
"dependencies": { "lib": "$LIB" },
"devDependencies": { "vite": "8.3.8" }
}
EOF
cat >pnpm-workspace.yaml <<EOF
allowBuilds:
'lib@$LIB': true
EOF
echo 'export default {};' >vite.config.ts
echo node_modules >.gitignore
git init -q && git add -A && git commit -qm init
check() { if [ -f node_modules/lib/dist/index.js ]; then echo "lib dist: present"; else echo "lib dist: MISSING"; fi; }
pnpm install >/dev/null
check # present
git add -A && git commit -qm installed
vp migrate --no-interactive --no-agent --no-editor --no-hooks
check # MISSING
vp install
check # still MISSING
pnpm install --force >/dev/null
check # presentSystem Info
# The global CLI is not installed here, so there is no `vp env current`.
$ vp --version
vp v1.8.0
Local vite-plus:
vite-plus v1.8.0
Node 26.13.1, pnpm 12.23.0, Windows 11Used Package Manager
pnpm
Logs
The steps above, run as written:
lib dist: present
$ vp migrate --no-interactive --no-agent --no-editor --no-hooks
● Formatting code...
● Code formatted
◇ Migrated . to Vite+ 1.8.0
• Node 26.13.1 pnpm 12.23.0
✓ Dependencies installed in 4.9s
lib dist: MISSING
$ vp install
Already up to date
Done in 8ms using pnpm v12.23.0
lib dist: MISSING
$ pnpm install --force
lib dist: presentAI disclosure: I found and wrote this with Claude Code (model: Claude Opus 5.5, claude-opus-5-5; its reasoning effort level is not shown to me). I ran the steps above with vite-plus 1.8.0 and pnpm 12.23.0.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Effort
Target date
Start date
Activity
voidzero-bot commentedon Nov 29, 2026
maincheckout (pnpm 12.23.0):lib dist: MISSINGaftervp migrate, still missing aftervp install, restored only bypnpm install --force.packages/cli/src/utils/__tests__/run-vite-install.spec.ts(new assertion fails without the fix, passes with it)vp install, thenvp build), but only for pnpm ≥ 11 projects with a git dependency whosedist/comes from an approvedpreparescript, andpnpm install --forcereliably recovers the state.runViteInstall(packages/cli/src/utils/prompts.ts) adds--ignore-scriptsto every auto-install on pnpm ≥ 11 unless the caller opts intodetectIgnoredBuilds, and neithervp migrateinstall opts in. That flag skips all lifecycle scripts — including builds the user already approved viaallowBuilds. It is normally harmless because a no-op reinstall re-runs nothing, but migration adds thevite@*→@voidzero-dev/vite-plus-coreoverride, which gives avite-peering git dependency a new virtual-store directory; pnpm re-fetches it there withprepareskipped, and no latervp install,pnpm rebuild, orvp pm approve-buildscan re-run a skippedprepare(pnpm/pnpm#18551).I found a potential fix for this issue. On the branch,
runViteInstallpasses--config.strict-dep-builds=false(throughvp install's--pass-through slot) instead of--ignore-scripts: auto-installs still exit 0, approved builds like the git dependency'spreparerun, and unapproved builds are skipped but remain recoverable viapnpm approve-builds. The reproduction keepsdist/present through migrate and the follow-upvp install, and the full unit suite plus the migration CLI snapshots pass.Full Triage Report
Triage Report — Issue #3603
Issue summary
vp migrateauto-installs with--ignore-scriptson pnpm ≥ 11(
shouldIgnoreScriptsForAutoInstallinpackages/cli/src/utils/prompts.ts,called from
runViteInstall; both install call sites inpackages/cli/src/migration/bin.tsleavedetectIgnoredBuildsoff). The intentis to avoid pnpm ≥ 11's
ERR_PNPM_IGNORED_BUILDShard failure while the userhas not yet approved build scripts.
For a git dependency whose
dist/is produced by itspreparescript, thealiasing of
viteto@voidzero-dev/vite-plus-corechanges the dependency'speer set, so pnpm places the git dependency in a new virtual-store directory
and re-fetches/relinks it. Because
--ignore-scriptsskipspreparethere,the dependency is installed without its
dist/. A latervp installreports"Already up to date" (nothing changed in the lockfile) and pnpm's
rebuilddoes not re-run a skipped
prepare, so onlypnpm install --forcerecovers.Expected: after migration (with the git dependency's build approved in
allowBuilds),node_modules/lib/dist/index.jsexists and the project builds.Actual:
dist/is missing aftervp migrate, still missing aftervp install,and only
pnpm install --forcerestores it.Environment
maincheckout (local build v1.8.0, reported byvp --versionasvp v1.8.0/ vite-plus v1.8.0)packageManager)pnpm@12.23.0(both ≥ 11, so--ignore-scriptsapplies)/tmp/vite-plus-triage/gh-3603/repro(script:repro.sh, log:repro.log)Commands attempted and results
Reproduction follows the issue's steps exactly, with
vp migratewrapped by thelocal npm registry (
packages/tools/src/local-npm-registry.ts --pack) so theproject installs the checkout's own vite-plus build:
pnpm install(before migrate)lib dist: presentvp migrate --no-interactive --no-agent --no-editor --no-hookslib dist: MISSINGvp installlib dist: MISSINGpnpm install --forcelib dist: presentagain (see note below)Note on the last step: the final
pnpm install --forcerestorednode_modules/lib/dist/index.js(the reported recovery), though it then exited 1with
ERR_PNPM_TARBALL_URL_MISMATCHon the@voidzero-dev/vite-plus-coreentry. That error is an artifact of the triage local registry only: the lockfile
records the registry bridge URL with the port of the first server run, and a
newly started registry server gets a different port. It does not affect the
reproduction of the reported behavior, which is fully visible in the three
preceding steps.
Control case
The same project state before migration keeps
lib dist: presentunder plainpnpm install(first row above), i.e. theallowBuildsapproval for the gitdependency works and the loss of
dist/only occurs after the migrateauto-install. This rules out a misconfigured reproduction (wrong
allowBuildskey, missing prepare, etc.) as the cause.
Result
Reproduced on the current checkout (
triagebot/fix-3603): aftervp migrate, the approved git dependency'sprepareoutput (dist/) ismissing,
vp installdoes not restore it, andpnpm install --forcedoes.Issue classification: Bug.
Diagnosis
Affected code (all on current
main)packages/cli/src/utils/prompts.ts:30-46shouldIgnoreScriptsForAutoInstall— returnstruefor pnpm ≥ 11packages/cli/src/utils/prompts.ts:132-215(runViteInstall)--ignore-scriptsonto the install args whendetectIgnoredBuildsis not setpackages/cli/src/migration/bin.ts:852and:1033vp migrateinstalls callrunViteInstallwithoutdetectIgnoredBuilds, with the detected pnpm versionpackages/cli/src/utils/command.ts:28-38(getVpCommand)vite-plus/bin install --ignore-scriptscrates/vp_pm_cli/src/resolution/commands/install.rs:111-131vp installmaps its own--ignore-scriptsflag and otherwise forwardspass_through_argsverbatim topnpm installRoot cause
runViteInstallunconditionally adds--ignore-scriptson pnpm ≥ 11 for everyauto-install that does not opt into
detectIgnoredBuilds— and neither migrateinstall opts in.
--ignore-scriptsdisables all lifecycle scripts, includingprepareof git dependencies whose build the user already approved viaallowBuilds/onlyBuiltDependencies.This is normally harmless because a no-op reinstall doesn't re-run anything.
Migration is the exception: it writes
which changes the resolved peers of every dependency with a
vitepeer. For agit dependency that means a new virtual-store directory. Observed in the
reproduction (
repro2, state inspected between migrate and--force):The two entries differ only in pnpm's peer-set hash suffix;
node_modules/libsymlinks to the new,
dist-less entry. Because--ignore-scriptswas ineffect, pnpm skipped the git dependency's
preparewhen populating the newdirectory.
Why nothing recovers it: the migrate install still exits 0 and produces a
consistent lockfile, so the next
vp install→pnpm installis a no-op("Already up to date"), and pnpm's
rebuilddoes not re-run apreparethatwas skipped (pnpm/pnpm#18551). Only
pnpm install --forcerefetches the gitdependency and runs
prepare, which restoresdist/(observed).Edge cases and caveats for the fix
vp install's argument parser rejects the flag form. Passing--config.strict-dep-builds=falsedirectly fails with clap'serror: Unexpected argument '--config.strict-dep-builds'(exit 2), whichmade the migrate install fail outright in the first experiment. The flag
must go through the pass-through slot:
installArgs.push('--', '--config.strict-dep-builds=false')— verified toreach pnpm as
pnpm install --config.strict-dep-builds=falseand exit 0.strictDepBuildsexists in pnpm ≥ 10.7 and became thedefault failure mode in pnpm 11. The workaround is only applied for
pnpm ≥ 11 today, so the replacement stays inside the same gate.
runViteInstallcallers:packages/cli/src/create/bin.tsshares the same helper; all its call sites use
detectIgnoredBuilds, sothey are unaffected by the change.
vp installalone cannot fix the after-the-fact state: once the newvirtual-store entry exists without
dist/, onlypnpm install --forcerefetches it. Fixing the flag used by the migrate auto-install is the
correct layer.
Regression evidence
Introduced by commit
b92a1afc0(2026-05-08,fix(cli): auto-pass --ignore-scripts when pnpm >=11 in migrate/create,PR #1533), which added
shouldIgnoreScriptsForAutoInstalland theinstallArgs.push('--ignore-scripts')branch.Confidence
high — the failing logic is proven by code inspection (flag added on pnpm
≥ 11 for both migrate installs, forwarded verbatim to
pnpm install), themissing-
diststate is observed in the new virtual-store directory, andswapping the flag for
--config.strict-dep-builds=falsemakes the approvedpreparerun again while keeping the unapproved build skipped.Verification
Claim
Observed (reproduced): after
vp migrateon pnpm ≥ 11, a git dependencywhose build is approved in
allowBuildsends up without itsprepare-builtdist/. The follow-upvp installis a no-op ("Already up to date"),vp pm approve-buildsreports nothing pending, and onlypnpm install --forcerecovers.
Expected (reporter): a migration whose git dependency build is approved via
allowBuildsleaves the project buildable; the documented post-migrationinstall is sufficient.
Verdict: bug (high confidence)
Documented post-migration flow is broken.
docs/guide/migrate.md("After running the migration: Run
vp install… Runvp build") promisesthat a follow-up install completes dependency installation and the build
works. Observed: the follow-up
vp installis a no-op andvp buildcannotresolve the library until
pnpm install --force.The workaround's own comment states a false assumption.
packages/cli/src/utils/prompts.ts:30-34: "the user's own subsequentvp installkeeps default pnpm behavior." For a git dependency re-fetchedinto a new virtual-store directory by the migration's
vite@*→@voidzero-dev/vite-plus-coreoverride, the subsequent install is a no-opand never re-runs
prepare.Maintainers already treat "unrecoverable gated builds" as a defect.
packages/cli/src/utils/prompts.ts(added withdetectIgnoredBuildsinPR feat(create): approve dependency build scripts blocked by the package manager #1828): "
--ignore-scripts… also makes the gated builds unrecoverable(
approve-buildsthen reports nothing pending)."vp createwas changed tosurface/approve builds because of exactly this problem;
vp migrateneveradopted the same treatment.
Documented product intent: no half-built projects.
docs/guide/create.md:108-112: create "surfaces gated builds afterinstalling instead of leaving the project in a half-built state."
Migration leaves an approved build half-built.
Vite+'s own recovery path cannot help. Verified on the reproduction:
vp pm approve-builds lib→[WARN] The following packages are not awaiting approval: lib, anddist/stays missing.pnpm rebuilddoes not re-run a skippedprepareeither (
pnpm rebuildnever runs a git-hosted dependency'spreparethat--ignore-scriptsskipped; onlypnpm install --forcedoes pnpm/pnpm#18551).No test or doc asserts the observed behavior. The only coverage asserts
the
--ignore-scriptsworkaround itself (install succeeds, exit 0); nothingasserts that approved builds may be lost. PR fix(cli): auto-pass --ignore-scripts when pnpm >=11 in migrate/create #1533's stated goal was only to
stop unapproved build scripts from failing auto-installs — not to suppress
builds the user already approved via
allowBuilds.Ownership: pnpm's
--ignore-scriptssemantics and itsrebuild/preparelimitation are upstream (pnpm/pnpm#18551), but the defect is Vite+'s: the
choice to pass
--ignore-scriptsduring migrate's install, and thevite@*→ core override that triggers the re-fetch, are both Vite+ decisions.Fix
Changed files
packages/cli/src/utils/prompts.tsshouldIgnoreScriptsForAutoInstallrenamed toshouldRelaxStrictDepBuildsForAutoInstall;runViteInstallnow passes-- --config.strict-dep-builds=false(viavp install's pass-through slot) instead of--ignore-scriptsfor pnpm ≥ 11 auto-installs; comments updatedpackages/cli/src/create/bin.ts--ignore-scripts(no behavior change)packages/cli/src/utils/__tests__/run-vite-install.spec.ts--ignore-scriptspackages/cli/src/utils/__tests__/prompts.spec.tsRationale
--config.strict-dep-builds=falseachieves the workaround's original goal(auto-installs do not hard-fail on pnpm ≥ 11's
ERR_PNPM_IGNORED_BUILDS) whilestill running builds the user approved via
allowBuilds/onlyBuiltDependencies— in particular a git dependency's
prepare. Unapproved builds are skipped andremain recoverable through
pnpm approve-builds. The flag must go throughvp install's pass-through slot (-- <arg>) becausevp install's argumentparser rejects
--config.<key>as a first-class flag. The existingdetectIgnoredBuildspath (used by allvp createinstalls) is unchanged: itkeeps the relaxation off so pnpm records gated builds.
Regression test
packages/cli/src/utils/__tests__/run-vite-install.spec.ts:"relaxes strict-dep-builds (and reports no pendingBuilds) when detection is off"
asserts the spawned install receives
-- --config.strict-dep-builds=false.Confirmed it fails without the fix (received
install --ignore-scripts)and passes with it. "keeps an explicit --ignore-scripts from the caller"
guards the existing escape hatch.
Validation
pnpm -F vite-plus build-ts)vp migrate→vp install, pnpm 12.23.0)lib dist: presentafter migrate and aftervp install(was MISSING)postinstallis unapproved)stamp: MISSING), install exits 0, approvedlibbuiltinstall-failure-guard,run-vite-install,promptsspecs)pnpm test:unit(vp test)just snapshot-test migrationvp checkgit status --short --untracked-files=allSkipped:
just check/just test/just lint(Rust workspace) — the changeis TypeScript-only and no Rust source changed; full
pnpm bootstrap-cli && pnpm test— covered by the unit suite plus the migration snapshot filter thatexercises
vp migrateend-to-end against the rebuiltpackages/cli/dist.Alternatives considered
--config/--no-strict-dep-buildsflag tovp installin
crates/vp_pm_cli— larger surface change across five package managers;the pass-through slot already delivers the flag verbatim to pnpm.
vp migrateadopt thedetectIgnoredBuilds+ approve-builds flow(as
vp createdoes) — better UX long-term but a larger behavioral change(interactive prompts inside migrate); out of scope for a minimal fix.
vp install(detect git deps missing theirprepareoutput) — pnpm's own rebuild cannot re-run a skipped
prepare(
pnpm rebuildnever runs a git-hosted dependency'spreparethat--ignore-scriptsskipped; onlypnpm install --forcedoes pnpm/pnpm#18551), so this would require--force-like refetches; fixing theflag at the source is correct.
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
I've opened a pull request with this fix: #3605