Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when vendoring remote modules containing npm specifiers #17210

Closed
jespertheend opened this issue Dec 28, 2022 · 2 comments · Fixed by #19186
Closed

Panic when vendoring remote modules containing npm specifiers #17210

jespertheend opened this issue Dec 28, 2022 · 2 comments · Fixed by #19186
Assignees
Labels
bug Something isn't working correctly vendor related to the vendor subcommand

Comments

@jespertheend
Copy link
Contributor

To reproduce

  1. Run the following command:deno vendor https://gist.githubusercontent.com/jespertheend/6f05a6c8ce082dcb976740db8e9232e7/raw/577685d2c8506d1d4d27d5fa2f6ddb5c1ffd4c54/import_npm_specifier.js.

Which is a file that contains only: import "npm:[email protected]";

============================================================
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 x86_64
Version: 1.29.1
Args: ["deno", "vendor", "https://gist.githubusercontent.com/jespertheend/6f05a6c8ce082dcb976740db8e9232e7/raw/577685d2c8506d1d4d27d5fa2f6ddb5c1ffd4c54/import_npm_specifier.js"]

thread 'main' panicked at 'Could not find local path for npm:[email protected]', cli/tools/vendor/mappings.rs:138:11
stack backtrace:
   0:        0x10a2ddeb7 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd2e8cbde22b780fc
   1:        0x1097a17fa - core::fmt::write::hd6692086cdd356a7
   2:        0x10a2acfac - std::io::Write::write_fmt::h6043124a2486acbb
   3:        0x10a2e2cab - std::panicking::default_hook::{{closure}}::h87a12b8b06887dd7
   4:        0x10a2e2973 - std::panicking::default_hook::h7f68dad17e0bfaa4
   5:        0x1096e2f50 - deno::setup_panic_hook::{{closure}}::h3c2f685e7d6b3aa1
   6:        0x10a2e3218 - std::panicking::rust_panic_with_hook::hd57427cbbfc3717a
   7:        0x10a2e2fe4 - std::panicking::begin_panic_handler::{{closure}}::h33aab6d04e2bba70
   8:        0x10a2e2f48 - std::sys_common::backtrace::__rust_end_short_backtrace::h0e7a76f927db9964
   9:        0x10a2e2f12 - _rust_begin_unwind
  10:        0x10b6e2ba3 - core::panicking::panic_fmt::hcf6f3c517c6f3cb3
  11:        0x1096bab89 - deno::tools::vendor::mappings::Mappings::local_path::hf942d439a0f2e7e7
  12:        0x1096ba9cf - deno::tools::vendor::mappings::Mappings::local_uri::h158514494ca09a71
  13:        0x1096babc0 - deno::tools::vendor::mappings::Mappings::relative_specifier_text::h597cd74bf0854bb9
  14:        0x1096b9977 - deno::tools::vendor::import_map::ImportsBuilder::add::h4ae1472cbec50ded
  15:        0x1096ba656 - deno::tools::vendor::import_map::visit_maybe_resolved::h9f11ab6ef7b6a8a9
  16:        0x1096b75d7 - deno::tools::vendor::build::build::ha2b59e1a6a87ebe1
  17:        0x1096d48d7 - deno::run_subcommand::{{closure}}::he6be3ac4aee88a96
  18:        0x1096e76f8 - deno::main::{{closure}}::h48c8ed1535d860ab
  19:        0x109526f9d - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h6ea21c59ce307865
  20:        0x1093711d5 - deno_runtime::tokio_util::run_local::h83b195a4ae96ef32
  21:        0x1096e322c - deno::main::hdfc9a952d3e6dfae
  22:        0x1093a9db1 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3bd53d04eab25172
  23:        0x109731622 - _main
@evelant
Copy link

evelant commented Mar 19, 2023

Also running into this I think. I'm having a heck of a frustrating time trying to use Deno migrating my firebase cloud functions to supabase edge functions. Roadblocks at every turn. Every time I think I've worked around one thing I run into another. ☹️

This time I tried to work around problems importing local packages from my pnpm workspace by vendoring them directly from a private github repo, only to run into this panic.

@jespertheend
Copy link
Contributor Author

Remote modules with npm specifiers require the --unstable flag. That's why this hasn't received much attention yet I believe.

@dsherret dsherret added bug Something isn't working correctly vendor related to the vendor subcommand labels May 18, 2023
@dsherret dsherret self-assigned this May 18, 2023
dsherret added a commit that referenced this issue May 19, 2023
We never properly added support for this. This fixes vendoring when it
has npm or node specifiers. Vendoring occurs by adding a
`"nodeModulesDir": true` property to deno.json then it uses a local
node_modules directory. This can be opted out by setting
`"nodeModulesDir": false` or running with `--node-modules-dir=false`.

Closes #18090
Closes #17210
Closes #17619
Closes #16778
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly vendor related to the vendor subcommand
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants