denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.06k stars 5.14k forks source link

Missing prompt Field Error When Compiling Deno Script #23735

Closed yazan-nidal closed 1 week ago

yazan-nidal commented 1 week ago

Version: Deno 1.43.1

I've been working on compiling a Deno script (script.ts) into an executable using deno compile. However, when attempting to run the resulting executable (script.exe), I encountered the following error:

thread 'main' panicked at cli\standalone\binary.rs:286:66:
called `Result::unwrap()` on an `Err` value: Error("missing field `prompt`", line: 1, column: 352)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at C:\a\deno\deno\runtime\tokio_util.rs:102:36:
called `Result::unwrap()` on an `Err` value: JoinError::Panic(Id(1), ...)

It appears that the error is related to a missing prompt field within the compiled executable. This issue is occurring even though my original script (script.ts) does not explicitly reference a prompt field.

Here's a snippet of the relevant portion of my script (script.ts):

const file = await Deno.open("D:\deno\forks\deno\a.js");
await file.readable.pipeTo(Deno.stdout.writable, { preventClose: true });

To compile the script, I used the following command: .\target\debug\deno.exe compile D:\deno\forks\deno\target\script.ts

And to run the resulting executable (script.exe), I used: .\script.exe

Could someone please help me understand why this error is occurring and how I might resolve it? Any guidance or insights would be greatly appreciated.

bartlomieju commented 1 week ago

Does the same problem occur on latest canary version (deno upgrade --canary)?

yazan-nidal commented 1 week ago

Does the same problem occur on latest canary version (deno upgrade --canary)?

no, its work on 'canary'

PS D:\deno\forks\deno> deno upgrade --canary
Looking up latest canary version Found latest version 5e6c72d39fc6bf809a71e4074e7d6f516d18486a Downloading https://dl.deno.land/canary/5e6c72d39fc6bf809a71e4074e7d6f516d18486a/deno-x86_64-pc-windows-msvc.zip Deno is upgrading to version 5e6c72d39fc6bf809a71e4074e7d6f516d18486a Upgraded successfully PS D:\deno\forks\deno> deno run --allow-read .\target\script.js Deno.connect({hostname:'api.notion.com.', port: 443}); PS D:\deno\forks\deno> deno compile --allow-read .\target\script.js Compile file:///D:/deno/forks/deno/target/script.js to script.exe PS D:\deno\forks\deno> .\script.exe Deno.connect({hostname:'api.notion.com.', port: 443});

bartlomieju commented 1 week ago

I believe it must have been fixed by https://github.com/denoland/deno/pull/23719. We will release v1.43.2 later tonight so I'm going to close this one for now.