Skip to content

pnpm run build fails on Windows with spawnSync npm ENOENT #190

Description

@knqiufan

What happened?

pnpm run build fails on Windows while bundling @step-harness/coding-agent. TypeScript compilation and copy-assets finish, then scripts/build-coding-agent-bundle.mjs exits with spawnSync npm ENOENT.

Environment: Windows 10 (10.0.26200), Node.js v24.14.1, pnpm 9.15.9, package @step-harness/coding-agent@0.84.4 at commit 8297eb5.

node:internal/child_process:1119
    result.error = new ErrnoException(result.error, 'spawnSync ' + options.file);
                   ^

Error: spawnSync npm ENOENT
  code: 'ENOENT',
  syscall: 'spawnSync npm',
  path: 'npm',
  spawnargs: [
    '--prefix',
    'D:\\code\\git-project\\Step-Code\\apps\\cli',
    'run',
    'build'
  ]
}

The stack points at execFileSync("npm", ["--prefix", appEntryDir, "run", "build"], ...) in scripts/build-coding-agent-bundle.mjs.

Earlier npm run build steps in the same pnpm run build succeed, because pnpm launches them through cmd.exe /c. execFileSync does not use a shell and does not search PATHEXT, so it looks for a file named npm. On Windows the executable is npm.cmd.

Steps to reproduce

  1. Clone the repo on Windows and run pnpm install --ignore-scripts.
  2. Run pnpm run build from the repository root.

Expected behavior

pnpm run build completes, including the CLI compile started by the coding-agent bundle script.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/buildscripts, .github, package.json, tsconfig, lockfilebugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions