denoland / deno

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

`Deno has panicked` via `task` command and `package.json` starting version `1.45.3` #25027

Open botikho opened 1 month ago

botikho commented 1 month ago

Facing a crash with Deno has panicked when trying to run a script via deno task dev targeting even an empty script.

Error details:

Platform: macos aarch64
Version: 1.45.5
Args: ["deno", "task", "dev"]

thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_semver-0.5.7/src/lib.rs:275:32:
programming error: cannot use matches with a tag: latest

No deno.lock file in project root.

package.json:

{
  "scripts": {
    "dev": "deno run server/router.ts",
  }
}

router.ts file exists and absolutely empty.

Running deno run server/router.ts cause no error.

Downgrade Deno to version 1.44.4 helped to avoid an error. Tried other versions:

botikho commented 1 month ago

Running a task with RUST_BACKTRACE=full

Platform: macos aarch64
Version: 1.45.5
Args: ["deno", "task", "dev"]

thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_semver-0.5.7/src/lib.rs:275:32:
programming error: cannot use matches with a tag: latest
stack backtrace:
   0:        0x105f4d488 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h205eab4daa59a56a
   1:        0x10516a678 - core::fmt::write::ha28d0fbf1a1eeba9
   2:        0x105f1e39c - std::io::Write::write_fmt::h54f6960924d6c6c0
   3:        0x105f4fe48 - std::sys_common::backtrace::print::hb748761a345859f9
   4:        0x105f4f760 - std::panicking::default_hook::{{closure}}::h6cb9ca91838de054
   5:        0x105f4f368 - std::panicking::default_hook::h83345dc5126de57b
   6:        0x1050675e8 - deno::setup_panic_hook::{{closure}}::h8beb0d9da1af166d
   7:        0x105f50738 - std::panicking::rust_panic_with_hook::h9305dc63490c537b
   8:        0x105f501bc - std::panicking::begin_panic_handler::{{closure}}::h0d6c6c01f5801c1a
   9:        0x105f50124 - std::sys_common::backtrace::__rust_end_short_backtrace::h2ace9f7ada66a76a
  10:        0x105f50118 - _rust_begin_unwind
  11:        0x105168b70 - core::panicking::panic_fmt::hf3031f82c202a80d
  12:        0x105aba3d0 - deno_semver::VersionReq::matches::h39608648ebf51e08
  13:        0x10577d6d4 - deno_npm::resolution::snapshot::NpmResolutionSnapshot::resolve_best_package_id::h7ee18680b5beaa60
  14:        0x104fab1cc - deno::npm::managed::resolvers::local::sync_resolution_with_fs::{{closure}}::hf1587e743216391f
  15:        0x1050b73a4 - <deno::npm::managed::resolvers::local::LocalNpmPackageResolver as deno::npm::managed::resolvers::common::NpmPackageFsResolver>::cache_packages::{{closure}}::h1c4b74d7830faafc
  16:        0x104fb2c3c - deno::npm::managed::ManagedCliNpmResolver::cache_packages::{{closure}}::h2adbfa70cfa695c0
  17:        0x104fb27d4 - deno::npm::managed::ManagedCliNpmResolver::add_package_reqs_raw::{{closure}}::h8f6a488990fe98aa
  18:        0x104fb2084 - deno::npm::managed::ManagedCliNpmResolver::add_package_reqs::{{closure}}::h7313f938064d60e9
  19:        0x104fb2f24 - deno::npm::managed::ManagedCliNpmResolver::ensure_top_level_package_json_install::{{closure}}::hbbdc974f6e0f2fd4
  20:        0x105059668 - deno::spawn_subcommand::{{closure}}::h1f86ae2c3de86685
  21:        0x104cde420 - <deno_unsync::tokio::task::MaskFutureAsSend<F> as core::future::future::Future>::poll::h5250ce18043a7f74
  22:        0x104e04d28 - tokio::runtime::task::raw::poll::h1d3247606ca282ac
  23:        0x105068900 - deno::main::h0ec29af85e46ce0a
  24:        0x104d550fc - std::sys_common::backtrace::__rust_begin_short_backtrace::h14281d663e45ea1f
  25:        0x1050d1a58 - _main
nathanwhit commented 1 month ago

Hello! I believe this is a duplicate of https://github.com/denoland/deno/issues/24932, which was fixed a few days ago.

For now you can downgrade, use canary (deno upgrade --canary), or wait for the next release (which should be next week).

Feel free to reopen if it's still an issue!

botikho commented 1 month ago

@nathanwhit Um, no. Still panics:

Task dev deno run -A --env --unstable-net server/router.ts

============================================================
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.46.0-rc.0+25bb59d
Args: ["/Users/botikho/.deno/bin/deno", "run", "-A", "--env", "--unstable-net", "server/router.ts"]

thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_semver-0.5.10/src/lib.rs:275:32:
programming error: cannot use matches with a tag: latest
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
nathanwhit commented 1 month ago

Oh interesting, sorry for prematurely closing!

Is there a deno.json file in the project? If so could you share the contents?

yazan-abdalrahman commented 1 month ago

@nathanwhit @botikho @bartlomieju I think it was resolved. image

botikho commented 1 month ago

No, still panics

Platform: macos aarch64
Version: 1.46.0-rc.0+7ca95fc
botikho commented 1 month ago

@nathanwhit

Is there a deno.json file in the project? If so could you share the contents?

No, no deno.json files in project root and its parents

dsherret commented 1 month ago

@botikho it would be helpful to provide a reproduction or please run the latest canary with RUST_BACKTRACE=1. What does the package.json look like?