#Problems with Deno run

1 messages · Page 1 of 1 (latest)

nova lava
#

update:

let process = await new Deno.Command("deno run --allow-all main.ts").spawn();

it's throwing :

error: Uncaught (in promise) NotFound: Failed to spawn 'deno run --allow-all main.ts': No such file or directory (os error 2) let process = await new Deno.Command("deno run --allow-all main.ts").spawn();

change to:

let process = await new Deno.Command("bun main.ts").spawn();

and throws:
error: Uncaught (in promise) NotFound: Failed to spawn 'bun main.ts': No such file or directory (os error 2) let process = await new Deno.Command("bun main.ts").spawn();

high flareBOT
#

I wasn't able to find the answer to your question in the official Deno documentation. However, based on the error message you provided and the code snippet, it seems like Deno is unable to find the file or directory specified in the cmd array of your Deno.run call.

One potential issue I can spot in your message is that you are using both "deno", "run", "-A", "main.ts" and "deno", "run", "--allow-all", "main.ts" in your cmd arrays. While this should not cause a "file or directory not found" error, it's worth noting that you are using two different ways to specify the allow-all permission. You should stick to one for consistency.

Another thing to check is the working directory from which you are running the Deno process. The error could be due to the main.ts file not being in the current working directory from which the script is executed. Make sure that main.ts is indeed in the directory where the Deno process is started.

Please note that this advice is not based on the Deno documentation, and you should double-check the accuracy of the advice given. If the issue persists, you may want to ensure that the file paths are correct and that there are no typos or other environmental factors that could be causing the issue.

astral fjord
#

new Deno.Command("deno", { args: ["run", "--allow-all", "main.ts"]});

#

even better, use Deno.execPath() to get full, absolute path of the deno binary, to make sure it's found: new Deno.Command(Deno.execPath(), { args: ["run", "--allow-all", "main.ts"]});