denoland / deno

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

Installation of script results in panic when using JSR https specifier #23739

Closed jsejcksn closed 1 week ago

jsejcksn commented 1 week ago

Version: Deno 1.43.1


According to the details in the linked issue below…

…it was previously possible to install a script hosted on jsr.io using an https specifier, but doing so in Deno v1.43.1 results in a panic:

RUST_BACKTRACE=1 deno install --force --allow-net --allow-read --allow-sys=networkInterfaces 'https://jsr.io/@std/http/0.224.0/file_server.ts'
⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use the `-g` or `--global` flag.

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos aarch64
Version: 1.43.1
Args: ["deno", "install", "--force", "--allow-net", "--allow-read", "--allow-sys=networkInterfaces", "https://jsr.io/@std/http/0.224.0/file_server.ts"]

thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_graph-0.74.3/src/packages.rs:217:8:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::unwrap_failed
   4: deno_graph::packages::PackageSpecifiers::add_dependency
   5: deno_graph::graph::Builder::load
   6: deno_graph::graph::Builder::visit
   7: deno_graph::graph::Builder::fill::{{closure}}
   8: deno_graph::graph::ModuleGraph::build::{{closure}}
   9: deno::graph_util::ModuleGraphBuilder::build_graph_with_npm_resolution::{{closure}}
  10: deno::module_loader::ModuleLoadPreparer::prepare_module_load::{{closure}}
  11: deno::module_loader::ModuleLoadPreparer::load_and_type_check_files::{{closure}}
  12: deno::spawn_subcommand::{{closure}}
  13: <deno_unsync::task::MaskFutureAsSend<F> as core::future::future::Future>::poll
  14: tokio::runtime::task::raw::poll
  15: deno::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
dsherret commented 1 week ago

Duplicates #23644

jsejcksn commented 1 week ago

Duplicates #23644

@dsherret Regarding the linked duplicate: the linked issue is about import and this is about the CLI command deno install

dsherret commented 1 week ago

It's the same underlying process. This is fixed in canary:

> deno install --force --allow-net --allow-read=. --allow-sys=networkInterfaces https://jsr.io/@std/http/0.224.0/file_server.ts                   
⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use the `-g` or `--global` flag.
✅ Successfully installed file_server
C:\Users\david\.deno\bin\file_server.cmd
C:\Users\david\.deno\bin\file_server (shell)
> file_server .
Listening on:
- Local: http://localhost:4507
- Network: http://172.28.48.1:4507