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
- 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
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"
- Command: Run
make clean && make html from the docs directory.
- 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.
Building documentation with
sphinx-json Windows fails with anOSError: [WinError 193] %1 is not a valid Win32 applicationerror whenjs_language = 'typescript'is set inconf.py. The build proceeds without error whenjs_languageis left at its default or explicitly set to'javascript'. This indicates an issue with howsphinx-jsinvokes the Node.js subprocess with TypeDoc on Windows.Steps to Reproduce
sphinx-js: Latest version frompiptypedoc: Latest version fromnpmconf.pysetup:make clean && make htmlfrom thedocsdirectory.WinError 193exception.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
node.exepath inconf.py.where nodeon the affected system showed bothC:\Program Files\nodejs\node.exeandC:\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.sphinx-js's TypeDoc subprocess handling.js_language = 'typescript'and relying on the JavaScript build works, indicating the core issue is limited to the TypeScript-specific codepath.