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

run executable error: [ERR_MODULE_NOT_FOUND] after deno compile #26619

Closed
ryanhex53 opened this issue Oct 29, 2024 · 1 comment
Closed

run executable error: [ERR_MODULE_NOT_FOUND] after deno compile #26619

ryanhex53 opened this issue Oct 29, 2024 · 1 comment
Labels
bug Something isn't working correctly compile related to the `deno compile` feature

Comments

@ryanhex53
Copy link

Version: Deno 2.0.3

main.ts

import { program } from "npm:commander@^12.1.0";

program.version(Deno.env.get("VERSION") ?? "0.0.1");
program.parse(Deno.args);

deno.json

{
  "imports": {
    "commander": "npm:commander@12.1.0"
  }
}

image

@marvinhagemeister marvinhagemeister added bug Something isn't working correctly compile related to the `deno compile` feature labels Oct 29, 2024
@ryanhex53
Copy link
Author

I'm new to Deno and made some modifications after digging into the documentation.

  1. Added a package.json file with "dependencies":
    {
      "dependencies": {}
    }
  2. Ran npm i commander.
  3. Removed imports from deno.json and added "nodeModulesDir": "auto".
  4. Removed the "npm:" prefix from import statements in main.ts.
  5. Executed deno compile --node-modules-dir -A main.ts.

So far, no errors have been found, but I'm not sure if this follows best practices.

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 compile related to the `deno compile` feature
Projects
None yet
Development

No branches or pull requests

2 participants