Skip to content

create-oxygen-wp fails on native Windows with Error: spawn EINVAL #71

Description

@gruntek

Description

When running create-oxygen-wp from PowerShell on native Windows, the installer fails after collecting the project details and attempting to start the initial setup.

Environment

  • Windows 11
  • PowerShell
  • Node.js 24.18.0
  • npm 12.0.1
  • create-oxygen-wp 0.2.0
  • create-katalystwp 0.8.0
  • Docker Desktop 4.83.0
  • Docker Engine 29.6.2
  • Git Bash installed

Steps to reproduce

Run:

npm create oxygen-wp@latest

Then:

  1. Enter a site name.
  2. Select a Windows directory.
  3. Choose Claude Code as the AI agent.
  4. Allow the installer to start the initial setup.

Actual result

The installer fails with:

Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:441:11)
    at spawn (node:child_process:796:9)
    at create-katalystwp/engine.js

The npm process finishes with:

npm error code 1
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c create-oxygen-wp

Docker itself is running correctly. Both the Docker client and server are available from PowerShell.

Expected result

The installer should scaffold the project and complete the initial setup successfully on native Windows.

Likely cause

It appears that create-katalystwp attempts to launch npm.cmd using child_process.spawn() without a shell.

On Windows, .cmd files need to be launched through cmd.exe or with an appropriate shell configuration.

A possible fix could be:

spawn(command, args, {
  shell: process.platform === "win32",
  ...options
});

Working workaround

The installation succeeds when the project is scaffolded without automatically starting the setup:

npx --yes create-oxygen-wp@latest winsan-oxy-v1 --agents=claude --scaffold-only --yes

Then Git Bash can be explicitly added to the current PowerShell session:

$env:Path = "C:\Program Files\Git\bin;C:\Program Files\Git\cmd;$env:Path"

After entering the generated project directory:

Set-Location "C:\katalyst-sites\winsan-oxy-v1"
npm run setup

The setup then completes successfully.

Additional note

On Windows, the bash command may resolve to the WSL launcher instead of Git Bash. In my case, I had to make sure the following executable was used:

C:\Program Files\Git\bin\bash.exe

It would be helpful if native Windows and PowerShell execution worked without requiring --scaffold-only and a manual setup step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions