Skip to content

Windows: spawn npx ENOENT, then shadcn unknown scheme for temp registry path #655

Open

Description

@andy-fitch

Area

Payload CMS config or admin

What happened?

Issue:
when doing 'npx payload-components add content-columns '
I get error:
payload-components: "content-columns" failed during registry-build.
Last error: spawn npx ENOENT

Steps to reproduce

Claude analysis:

Steps to reproduce
npx payload-components add content-columns
There are two separate bugs. Fixing the first one exposes the second.

  1. registry-build fails with spawn npx ENOENT

payload-components: "content-columns" failed during registry-build.
Last error: spawn npx ENOENT
Cause: runCommand in dist/cli.js calls spawn(command, args, {...}) with no shell option. On Windows, npx, npm, pnpm, yarn and bunx are .cmd shims, and spawn can't find them without a shell, so every package manager fails the same way. Recent Node versions also refuse to spawn .cmd files directly without shell: true, so calling npx.cmd instead won't work.

Workaround I used:

const child = spawn(command, args, {
cwd,
detached: process.platform !== "win32",
shell: process.platform === "win32",
...
Node then prints a DEP0190 warning, because with shell: true the args are joined without escaping. A cleaner fix would be cross-spawn, or quoting the args on Windows. Paths with spaces would probably break under the plain shell: true workaround.

  1. registry-add fails with unknown scheme

Request to c:\Users...\Temp\payload-components-registry-XXXX\content-columns.json failed, reason: unknown scheme
Cause: installRegistryItem passes the absolute Windows path of the built item to shadcn add. shadcn decides whether its argument is a URL with new URL(e), and new URL("C:\...") succeeds with the scheme c:. So any Windows absolute path is treated as a URL and fetched. This part is arguably a shadcn bug, and I'm happy to report it there too.

Workaround I used: on Windows, pass the path without the drive letter and with forward slashes, and make sure the OS temp dir is on the same drive as the project (for example set TEMP=F:\tmp):

process.platform === "win32"
? itemFilePath.replace(/^[A-Za-z]:/, "").replace(/\/g, "/")
: itemFilePath
Possible proper fixes:

Write the built registry to a temp dir inside the target project and pass a relative path such as ./.payload-components/tmp/content-columns.json. shadcn recognises ./ paths as local.
Or get shadcn to reject single-letter schemes in its URL check.
Result
With both changes, add content-columns finished: the files were created, the block was wired up, and generate:types and generate:importmap ran. doctor reports all checks [ok].

Minor
After the first failure, a partial install can leave a stale lock for a short time ("Another payload-components command is already changing…"). It cleared itself once the old process exited.

Environment

Environment
Windows 11 Pro (10.0.26100), npm
payload-components 1.8.0, shadcn 4.18.0
Payload website starter (Payload 3.93, Next 16)
Node v26.13.0
npm 11.6.2

Logs or screenshots

Activity

  1. added
    bug
    on Nov 5, 2026
  2. andy-fitch commented on Nov 5, 2026

    @andy-fitch
    Author

    Very cool repo BTW - excited to try to use these - thx for all the work!

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions