Skip to content

[bug] package-artifacts fails on Windows when spawning pnpm from Node child processes #210

Closed

Description

@Aryan1718

What's the bug?

Summary

The packages-artifacts workflow appears to rely on command execution behavior that works reliably on macOS/Linux but is fragile on Windows environments.

Currently, artifact build or verification scripts may fail on Windows when attempting to invoke pnpm from Node.js child-process execution APIs. This commonly happens because Windows exposes pnpm through command shims (pnpm.cmd) rather than direct binaries, which can behave differently depending on how child processes are spawned.

As a result, Windows users can encounter failures even when:

  • pnpm is correctly installed
  • pnpm works normally in terminal sessions
  • the documented project prerequisites are satisfied

This creates a platform-specific issue in the artifact packaging and verification flow.


Expected Behavior

Artifact packaging and verification commands should execute successfully on Windows when:

  • Node.js is installed
  • pnpm is installed and accessible in the user PATH
  • project setup follows the documented prerequisites

The workflow should function consistently across:

  • Windows
  • macOS
  • Linux

without requiring machine-specific configuration or PATH workarounds.


Actual Behavior

On Windows, artifact packaging or verification may fail when the script attempts to launch pnpm using Node.js child-process execution.

The failure appears related to command resolution differences between Unix-based systems and Windows command shims.

This causes the packaging workflow to become unreliable for Windows contributors and users.


Possible Root Cause

The current implementation may:

  • assume Unix-style executable resolution
  • invoke pnpm directly without Windows-aware handling
  • use child-process APIs that do not correctly resolve .cmd shims on Windows

This commonly affects:

  • spawn
  • execFile
  • direct binary invocation patterns

when used without:

  • shell: true
  • explicit .cmd handling
  • cross-platform command resolution utilities

Suggested Fix

Implement a cross-platform command execution strategy for invoking pnpm from Node child processes.

Potential approaches include:

  • resolving the correct executable on Windows (pnpm.cmd)
  • using shell: true where appropriate
  • using a portable process execution library
  • adding explicit platform-aware command handling

The final implementation should avoid:

  • machine-specific assumptions
  • hardcoded paths
  • manual Windows-only setup steps

How can we reproduce it?

1. Use a clean Windows machine or VM.

2. Install the documented project prerequisites:
   - Node.js 22+
   - Corepack enabled
   - pnpm activated through the standard project setup flow

3. Clone the repository.

4. Run the normal workspace setup commands.

5. From the repository root, execute the artifact packaging or verification flow:

pnpm run artifacts:verify
          or
node scripts/package-artifacts.mjs check

KTX version

0.4.1

Which area?

CLI / setup

Anything else?

No response

Activity

  1. added
    bug
    on May 24, 2026
  2. added
    needs-triage
    on May 24, 2026
  3. Aryan1718 commented on May 24, 2026

    @Aryan1718
    ContributorAuthor

    Hello @luca-martial and @andreybavt, can you please review this bug? If it is something that should be addressed, I would like to work on this issue. I solved this issue for my local workspace, so it would be easier for me to fix it.

  4. andreybavt commented on May 24, 2026

    @andreybavt
    Contributor

    Hey @Aryan1718 , will check ASAP

  5. andreybavt commented on May 24, 2026

    @andreybavt
    Contributor

    @Aryan1718 the suggested fix makes sense, if you could take care of it that'd be great because we don't have windows machines on our side. Thank you!

  6. removed
    needs-triage
    on May 24, 2026
  7. Aryan1718 commented on May 24, 2026

    @Aryan1718
    ContributorAuthor

    Yes @andreybavt, I will do that. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions