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

deno task from workspace module is not resolving the module #28372

Open
ansemb opened this issue Mar 3, 2025 · 1 comment
Open

deno task from workspace module is not resolving the module #28372

ansemb opened this issue Mar 3, 2025 · 1 comment
Labels
task runner related to deno task

Comments

@ansemb
Copy link

ansemb commented Mar 3, 2025

Hi,

I wanted to try out deno in our repo by first converting our tools to use deno.

I've added a simple repro here:

deno-private-npm-repro.

I added a workspace with the tool:

{
  "workspace": {
    "members": ["./modules/some-other-tool"]
  },
  "tasks": {
    "hello": "deno run @mynamespace/some-other-tool",
    "hellojsr": "deno run jsr:@mynamespace/some-other-tool",
    "hello-rel": "deno run ./modules/some-other-tool/index.ts"
  },
  "imports": {
    "@mynamespace/some-other-tool": "jsr:@mynamespace/some-other-tool"
  }
}

Then I want to use this tool inside some of the packages/* e.g. ui.

I would expect deno run @mynamespace/some-other-tool (or deno run jsr:@mynamespace/some-other-tool) to resolve to modules where the tool resides.

cd packages/ui

❯ deno task deno-hello
Task deno-hello deno task --cwd . hello
Task hello deno run @mynamespace/some-other-tool/index.ts
error: Module not found "file:///<user>/code/repos/deno-private-npm-repro/packages/ui/@myn

Stack backtrace:
   0: std::backtrace::Backtrace::capture
   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
   2: deno::tools::run::run_script::{{closure}}
   3: deno::spawn_subcommand::{{closure}}
   4: <deno_unsync::tokio::task::MaskFutureAsSend<F> as core::future::future::Future>::poll
   5: tokio::runtime::task::raw::poll
   6: deno::main
   7: std::sys::backtrace::__rust_begin_short_backtrace
   8: _main

❯ deno task deno-hello-jsr
Task deno-hello-jsr deno task --cwd . hellojsr
Task hellojsr deno run jsr:@mynamespace/some-other-tool/index.ts
error: JSR package not found: @mynamespace/some-other-tool

Stack backtrace:
   0: std::backtrace::Backtrace::capture
   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
   2: deno::tools::run::run_script::{{closure}}
   3: deno::spawn_subcommand::{{closure}}
   4: <deno_unsync::tokio::task::MaskFutureAsSend<F> as core::future::future::Future>::poll
   5: tokio::runtime::task::raw::poll
   6: deno::main
   7: std::sys::backtrace::__rust_begin_short_backtrace
   8: _main

NOTE: Running the tool with a relative path works deno run ./modules/some-other-tool/index.ts, however, we need to set the cwd from the package from which the tool is running when running with deno task <> from this package. Or, we would need a relative path from the package to the tool, which seems a bit cumbersome.


deno 2.2.2 (stable, release, aarch64-apple-darwin)
v8 13.4.114.9-rusty
typescript 5.7.3

@marvinhagemeister marvinhagemeister added the task runner related to deno task label Mar 3, 2025
@ansemb
Copy link
Author

ansemb commented Mar 3, 2025

This might be related 🤔

#26247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task runner related to deno task
Projects
None yet
Development

No branches or pull requests

2 participants