Skip to content

docs: use npx.cmd on Windows in client example#68

Merged
benbrandt merged 1 commit intoagentclientprotocol:mainfrom
formulahendry:junhan/fix-client-example
Feb 6, 2026
Merged

docs: use npx.cmd on Windows in client example#68
benbrandt merged 1 commit intoagentclientprotocol:mainfrom
formulahendry:junhan/fix-client-example

Conversation

@formulahendry
Copy link
Contributor

When running src/examples/client.ts on Windows, meet with below error:

PS C:\code\typescript-sdk> npx tsx src/examples/client.ts
node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: spawn npx ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {       
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn npx',
  path: 'npx',
  spawnargs: [ 'tsx', 'C:\\code\\typescript-sdk\\src\\examples\\agent.ts' ]
}

Node.js v22.19.0

On Windows, npx is installed as a batch script wrapper (npx.cmd), not a native executable. Node.js spawn() without a shell calls the OS directly, which only looks for exact filenames and won't try appending .cmd — causing an ENOENT error. Using npx.cmd explicitly resolves this without the side effects of shell: true.

@benbrandt benbrandt changed the title fix: use npx.cmd on Windows in client example docs: use npx.cmd on Windows in client example Feb 6, 2026
Copy link
Member

@benbrandt benbrandt left a comment

Choose a reason for hiding this comment

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

thanks!

@benbrandt benbrandt merged commit fdc7815 into agentclientprotocol:main Feb 6, 2026
2 checks passed
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.

2 participants