Running these "Install from source" instructions, I get an error:
error: Uncaught Error: %1 is not a valid Win32 application. (os error 193)
Specifically the instructions include:
- Run deno task build
- Where the buildtask is configured indeno.jsonas:- "build": "deno run --allow-all --unstable './tasks/build.ts'",
 
- Where the build.tseventually runs code like this:
- await Deno.run({ cmd: ["./node_modules/.bin/esbuild"] }).status()
I use Windows machine, and the command "./node_modules/.bin/esbuild" works from both my Windows cmd and my Git Bash.
I have deno --version:
$ deno --version
deno 1.33.4 (release, x86_64-pc-windows-msvc)
v8 11.4.183.2
typescript 5.0.4
I saw Deno.run is deprecated, so I used new Deno.Command(...) instead, I still get the error.
I tried playing with certain CommandOptions to specify the cwd and set windowsRawArguments to true, but it doesn't work.
I tried checking other similar questions
- This Python question, the issue is 32 bit vs 64 bit DLL's, and a similar question on x86 vs x64 I don't think that's my problem
- This Python question, the solution is to use shell=True, but I don't think Deno has the equivalent option
EDIT
I understand the difference between the different commands. I understand how the esbuild.cmd file emulates the esbuild "shebang" line
node_modules
 > .bin
     > esbuild      #This is for Unix, has shebang
     > esbuild.cmd  #This is for Windows
     > esbuild.ps1
That doesn't explain why Deno can't run the esbuild.
My Python can run the esbuild, without needing to use esbuild.cmd (notice I use shell=True). Without shell=True, I get the same error as with Deno. So maybe my question is better restated as, "how can I do the equivalent of Python's shell=True in Deno?")
subprocess.call('"./node_modules/.bin/esbuild"', shell=True)
My Windows command line (after I open it) can run  the esbuild, without needing to use esbuild.cmd (I have Git Bash installed, but see the screenshot, I am using Windows command prompt)

When I run cmd.exe "./node_modules/.bin/esbuild", it does not work, I get an error:
'"./node_modules/.bin/esbuild"' is not recognized as an internal or external command, operable program or batch file.
When I use Node instead of Deno, I get the same error:
const {spawn} = require('child_process');
const esbuild = spawn('"./node_modules/.bin/esbuild"', {shell:true}); 
esbuild.stderr.setEncoding('utf8'); 
esbuild.stderr.on('data',_=>console.error(_))     
>> '"./node_modules/.bin/esbuild"' is not recognized as an internal or external command, operable program or batch file.
Ultimately I guess the workaround is "stop trying to behave like Linux, you're using Windows, accept that and just use the esbuild.cmd file"
But I'm still curious about why some languages/subprocesses can run the esbuild (Python shell=True), but others cannot (cmd.exe run with args, Deno, Node with shell=True). It's small silly detail with lots of nuance, but maybe not significant enough to remain a question...
