Skip to content

Windows build fails with "WinError 193" when js_language = 'typescript' #285

@itsm3abena

Description

@itsm3abena

Building documentation with sphinx-js on Windows fails with an OSError: [WinError 193] %1 is not a valid Win32 application error when js_language = 'typescript' is set in conf.py. The build proceeds without error when js_language is left at its default or explicitly set to 'javascript'. This indicates an issue with how sphinx-js invokes the Node.js subprocess with TypeDoc on Windows.

Steps to Reproduce

  1. Environment:
    • OS: Windows 10/11 (x64)
    • Python: 3.x (x64)
    • Node.js: 18+ (x64)
    • sphinx-js: Latest version from pip
    • typedoc: Latest version from npm
  2. conf.py setup:
    # ... other configurations
    extensions = [
        "sphinx_js",
        # ... other extensions
    ]
    js_source_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src"))
    js_language = 'typescript'
    jsdoc_config_path = "../typedoc.json"
    # Optional, but tried explicitly to confirm:
    js_node_executable = r"C:\Program Files\nodejs\node.exe"
  3. Command: Run make clean && make html from the docs directory.
  4. Observe: The build fails with the WinError 193 exception.

Expected Behavior

The documentation should build successfully for TypeScript source files, similar to how it builds for JavaScript. The Node.js subprocess should be invoked correctly by sphinx-js.

Actual Behavior

The build process is terminated with an OSError: [WinError 193], indicating that the subprocess call to Node.js was invalid.

Additional Information

  • This error is consistent even after ensuring both Python and Node.js are 64-bit and hardcoding the node.exe path in conf.py.
  • Running where node on the affected system showed both C:\Program Files\nodejs\node.exe and C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\node.cmd. Disabling the WindowsApps alias did not resolve the issue, suggesting a deeper conflict in the subprocess invocation.
  • The same setup works without issue on a Linux system, confirming the problem is specific to the Windows implementation of sphinx-js's TypeDoc subprocess handling.
  • Disabling js_language = 'typescript' and relying on the JavaScript build works, indicating the core issue is limited to the TypeScript-specific codepath.

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