Skip to content

feat(install): support pnpm v12 native binary distribution - #2289

Merged
fengmk2 merged 12 commits into
voidzero-dev:mainfrom
jong-kyung:fix/pnpm-v12-native-binary
Aug 3, 2026
Merged

feat(install): support pnpm v12 native binary distribution#2289
fengmk2 merged 12 commits into
voidzero-dev:mainfrom
jong-kyung:fix/pnpm-v12-native-binary

Conversation

@jong-kyung

@jong-kyung jong-kyung commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

This fixes running pnpm 12 (currently 12.0.0-beta.0) through Vite+. Executing any pnpm command failed with:

error: Failed to exec .../.vite-plus/package_manager/pnpm/12.0.0-beta.0/pnpm/bin/pnpm: No such file or directory
(os error 2)

Root cause

pnpm 12 is a native binary (Rust rewrite). The pnpm npm package no longer ships bin/pnpm.cjs — it only contains shebang-less placeholder bins that a preinstall script replaces with the platform binary from the @pnpm/exe.* optional dependencies (install.js).
Vite+ extracts the tarball without running lifecycle scripts, so create_shim_files found no JS entrypoint, silently created no shims, and the exec of bin/pnpm failed. The completeness check also never passed, so every invocation re-downloaded the tarball.

Fix

For pnpm >= 12, download the platform-specific @pnpm/exe.{os}-{arch} package directly and place the binary at bin/pnpm.native with native shims, mirroring the existing bun flow. pnpm <= 11 keeps the JS flow unchanged.

The pnpx shim injects dlx explicitly: upstream's binary self-detects its launch name via current_exe to alias pnpx (argv_with_alias_subcommand), which a wrapper script cannot trigger. This matches upstream's own Unix pnpxscript (exec pnpm dlx "$@"). Shims
generated with no injected args are byte-identical to before, so bun is unaffected.

Resolves #2276

pnpm >= 12 is a native binary: the npm package only ships placeholder
bins that a preinstall script replaces from the platform-specific
@pnpm/exe.* packages. Lifecycle scripts never run for managed package
manager installs, so no bin/pnpm.cjs exists and exec of bin/pnpm failed
with ENOENT (and the completeness check re-downloaded on every run).

Download the @pnpm/exe.{os}-{arch} package directly for pnpm >= 12,
place the binary at bin/pnpm.native, and create native shims, mirroring
the bun flow. The pnpx shim injects dlx explicitly because shims do not
preserve the launch name the binary self-detects for alias behavior.

Fixes voidzero-dev#2276
@netlify

netlify Bot commented Aug 1, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 5a5ecb9
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a700ae3841ae8000894e9b2
😎 Deploy Preview https://deploy-preview-2289--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@jong-kyung jong-kyung changed the title fix(install): support pnpm v12 native binary distribution feat(install): support pnpm v12 native binary distribution Aug 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 891f54bd39

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_install/src/package_manager.rs Outdated
The hash names the main pnpm tarball, not the platform package: verify
it against the artifact it describes before the native download, so a
bad pin fails the same way it does for pnpm <= 11.
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8e25e0645

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_install/src/package_manager.rs Outdated
The hash path reuses the same download_and_extract_tgz_with_hash /
verify_file_hash mechanism the pnpm <= 11 flow uses, which is already
covered by the mock-server tests in request.rs; neither flow needs a
registry-hitting integration test for it.
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@jong-kyung jong-kyung self-assigned this Aug 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 98062166c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_install/src/package_manager.rs
@jong-kyung
jong-kyung marked this pull request as ready for review August 1, 2026 10:51
@jong-kyung
jong-kyung requested a review from fengmk2 August 1, 2026 10:51
Comment thread crates/vite_install/src/package_manager.rs Outdated
The @pnpm/exe.* platform tarball was downloaded without any hash check
because the declared packageManager hash only names the main pnpm
package. Fetch the platform package's registry version metadata and
verify the tarball against its dist.integrity (SRI), converted to the
algo.hex format verify_file_hash already understands. Registries that
omit the field keep the previous unverified behavior.
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 76664d98b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_install/src/package_manager.rs Outdated
…trip

Teach verify_file_hash the registry dist.integrity SRI format
(algorithm-base64) alongside the declared algorithm.hex format, comparing
the digest in the encoding the expected hash uses. The pnpm 12 flow now
passes dist.integrity straight through instead of converting it to hex
first, dropping sri_to_expected_hash.
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b3913c3a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_install/src/request.rs
@jong-kyung
jong-kyung requested a review from fengmk2 August 2, 2026 15:51
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11715354e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_install/src/package_manager.rs
Comment thread crates/vite_install/src/package_manager.rs
Comment thread crates/vite_install/src/request.rs Outdated
@fengmk2
fengmk2 merged commit cc455a3 into voidzero-dev:main Aug 3, 2026
44 checks passed
@jong-kyung
jong-kyung deleted the fix/pnpm-v12-native-binary branch August 3, 2026 03:49
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.

Support for pnpm v12

2 participants