Skip to content

Let pnpm recreate node_modules during Next.js deploy - #57

Merged
setoelkahfi merged 2 commits into
developmentfrom
fix/pnpm-purge-no-tty
Sep 30, 2026
Merged

setoelkahfi merged 2 commits into
developmentfrom
fix/pnpm-purge-no-tty

Conversation

@setoelkahfi

Copy link
Copy Markdown
Collaborator

smb deploy for a nextjs-ssr project failed at the install step with:

ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY  Aborted removal of modules directory due to no TTY

We capture pnpm's stdout/stderr to keep the spinner clean, so pnpm has no TTY. If node_modules was installed by a different pnpm (here pnpm 11 installed it and pnpm 10 was first on PATH), pnpm wants to wipe and recreate it, can't prompt, and gives up.

The fix passes --config.confirm-modules-purge=false when the package manager is pnpm. I didn't use CI=true because that also turns on --frozen-lockfile, which would break deploys with a slightly stale lockfile.

Tested by reproducing the error with pnpm 10.25.0 against a pnpm 11 node_modules, then running the same install with the flag on a copy of the project. It purged and reinstalled cleanly. clippy is clean.

Release Notes:

  • Fixed smb deploy failing on Next.js projects when pnpm needs to recreate node_modules.

The install step captures pnpm's output, so pnpm has no TTY. When it
needs to recreate node_modules (for example after a different pnpm
major version installed it), it can't ask for confirmation and aborts
with ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY.

Pass --config.confirm-modules-purge=false to pnpm so it purges without
asking. npm and yarn are left alone.

Co-Authored-By: siGit Code <noreply@sigit.si>

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified the Next.js SSR deploy process to add the flag --config.confirm-modules-purge=false when running pnpm install with captured stdio, to avoid the error ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY when pnpm needs to recreate node_modules without a TTY. This prevents deploy failures due to pnpm aborting the removal of the modules directory.


Automated review by siGit Code Review · commit 052e2e8 · see the review dashboard

Comment thread crates/cli/src/cloud-deploy/process_deploy_nextjs_ssr.rs Outdated
Comment thread crates/cli/src/cloud-deploy/process_deploy_nextjs_ssr.rs
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 490bda3f-7cd8-4b47-8612-149e13a6505d


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@setoelkahfi setoelkahfi self-assigned this Sep 30, 2026
Co-Authored-By: siGit Code <noreply@sigit.si>

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes the ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY deploy failure by passing --config.confirm-modules-purge=false to pnpm installs in process_deploy_nextjs_ssr, so pnpm can recreate an incompatible node_modules without a TTY prompt. The command builder was restructured into a mut builder to conditionally add the flag, with the install/output handling otherwise unchanged. Both open threads from the earlier review are resolved here: the fragile literal "pnpm" comparison is now a case-insensitive file_stem match that also covers full paths and Windows pnpm.cmd shims, and the requested note on why CI=true was avoided is in the comment (line 223). I verified the time-sensitive claims against public pnpm sources: confirmModulesPurge is a real setting in pnpm 10/11 that skips the purge confirmation, and pnpm does enable --frozen-lockfile by default when CI=true, so the author's reasoning for not using CI=true holds. The kebab-case --config. form was empirically tested by the author against pnpm 10.25.0 and pnpm normalizes kebab-case CLI flags to camelCase settings, so the flag name is fine. No new issues found.


Automated review by siGit Code Review · commit 761660c · see the review dashboard

@setoelkahfi
setoelkahfi requested a review from paydii September 30, 2026 09:50
@setoelkahfi
setoelkahfi merged commit b71bff1 into development Sep 30, 2026
7 checks passed
@setoelkahfi
setoelkahfi deleted the fix/pnpm-purge-no-tty branch September 30, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants