Repository navigation
Stop pnpm install from failing when it wants to recreate node_modules without a terminal - #411
Merged
Merged
Conversation
UPM runs pnpm without a stdin, so when pnpm decides node_modules has to be recreated it cannot ask for confirmation and aborts with ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY. Pass --config.confirm-modules-purge=false so pnpm proceeds, as it already does in CI. Assisted-by: Replit
akramhussein
marked this pull request as ready for review
November 5, 2026 18:35
akramhussein
requested review from
darshkpatel
and removed request for
a team
November 5, 2026 18:35
joe-thom
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When UPM runs
pnpm installin an automated context, such as a Replit deployment build, pnpm has no terminal to talk to. If pnpm decides the existingnode_moduleshas to be recreated (its store path, layout version or hoisting settings no longer match), it tries to ask "remove node_modules?" first. With no terminal it cannot ask, so it aborts withERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTYand the install fails.UPM always starts pnpm without a stdin, so this prompt can never be answered through UPM. The only thing a user could do was put
confirmModulesPurge: falsein their ownpnpm-workspace.yaml.What changed
pnpm install(used by bothupm lockandupm installfor the pnpm backend) now passes--config.confirm-modules-purge=false. That answers the prompt up front, which is the same answer pnpm assumes when it detects CI. It changes nothing else: lockfile handling, frozen installs and so on are untouched, which is why this is preferred over settingCI=true.The flag is accepted by pnpm 8, 9, 10 and 11 (checked against 8.15.9, 9.15.9, 10.26.1 and 11.9.0).
Test plan
Reproduced the failure with a small project installed by pnpm 10.26.1, then edited
node_modules/.modules.yamlto pointstoreDirat a different path so pnpm wants to recreatenode_modules. Ran UPM with stdin redirected from/dev/null:upm -l nodejs-pnpm install --force </dev/nullexits 16 withERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY.node_modulesand reportsPackages: +11.Also ran
go vet ./internal/backends/nodejs/andgofmt -l(clean).~ written by ⠕ Replit