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

node compatibility issue with libp2p #19865

Open
uriva opened this issue Jul 18, 2023 · 3 comments
Open

node compatibility issue with libp2p #19865

uriva opened this issue Jul 18, 2023 · 3 comments
Labels
bug Something isn't working correctly node compat

Comments

@uriva
Copy link

uriva commented Jul 18, 2023

import { createLibp2p } from "npm:libp2p";
import { tcp } from "npm:@libp2p/tcp";

const node = await createLibp2p({
  transports: [tcp()],
});
error: Uncaught SyntaxError: The requested module 'jsbn' does not provide an export named 'BigInteger'
    at <anonymous> (file:///home/uri/.cache/deno/npm/registry.npmjs.org/@achingbrain/ip-address/8.1.0/dist/esm/lib/ipv4.js:5:10)
@sigmaSd
Copy link
Contributor

sigmaSd commented Jul 18, 2023

seems the npm compat doesn't handle code like this

(function () {
  if (typeof exports !== "undefined") {
    exports = module.exports = {
      default: 4,
      BigInteger: 4,
    };
  } else {
    this.jsbn = {
      BigInteger: 4,
    };
  }
}).call(this);

seems like deno is not detecting that it needs to use commonjs here

@bartlomieju
Copy link
Member

Looks like it was fixed in deno_ast already. We need for the update of that crate to close this issue.

@birkskyum
Copy link
Contributor

birkskyum commented Aug 29, 2023

deno_ast 0.28.0 is out - seems to have been updated in deno already, but not in deno_core, so is it the deno_core that needs to be updated for this to work?

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 node compat
Projects
None yet
Development

No branches or pull requests

4 participants