Strange error message if you typo a remote package URL in a single-file script
Version: Deno 2.0.0
Detailed version info:
deno 2.0.0 (stable, release, aarch64-apple-darwin)
v8 12.9.202.13-rusty
typescript 5.6.2
Running deno index.ts with a clean cache (ran deno clean immediately before) in a directory containing only index.ts with the following contents:
import { DB } from "https://deno.land/x/[email protected]/mod.ts"
(note: the [email protected] instead of [email protected] is intentional; that's what triggers this strange and misleading error)
...results in the following error:
deno-experiments % deno -A index.ts
error: unrecognized subcommand
tip: some similar subcommands exist: 'init', 'lint'
try deno run xxx
PS D:\yad\deno> .\target\debug\deno -A .\main.ts
error: Module not found "https://deno.land/x/[email protected]/mod.ts".
at file:///D:/yad/deno/main.ts:1:20
PS D:\yad\deno> .\target\debug\deno run -A .\main.ts
error: Module not found "https://deno.land/x/[email protected]/mod.ts".
at file:///D:/yad/deno/main.ts:1:20
PS D:\yad\deno>
I think it works; it is not a bug.
I can not reproduce it, but I believe you this bug exists. The cause is likely in how we handle deno main.ts compared to deno run main.ts. Relevant code that is likely broken is https://github.com/denoland/deno/blob/afb33b3c2597c9ec943f71218b236486fbc86e23/cli/main.rs#L219.